How can I get the mouse wheel to work correctly with the Silverlight 4 ScrollViewer

Posted by Ian Oakes on Stack Overflow See other posts from Stack Overflow or by Ian Oakes
Published on 2010-06-07T03:29:14Z Indexed on 2010/06/07 3:32 UTC
Read the original article Hit count: 210

Filed under:

When I use the following xaml in Silverlight 4, the ScrollViewer will not recognize the mouse wheel unless I click once on the scroll bar thumb, and keep the mouse over the scroll bar, while turning the mouse wheel.

<Grid x:Name="LayoutRoot" Background="White">
    <ScrollViewer>
        <StackPanel Name="stackPanel1">
            <Button Content="Button 1" Width="150" />
            <Button Content="Button 2" Width="150" Margin="0,20,0,0" />
            <Button Content="Button 3" Width="150" Margin="0,20,0,0" />
            <Button Content="Button 4" Width="150" Margin="0,20,0,0" />
            <Button Content="Button 5" Width="150" Margin="0,20,0,0" />
            <Button Content="Button 6" Width="150" Margin="0,20,0,0" />
            <Button Content="Button 7" Width="150" Margin="0,20,0,0" />
        </StackPanel>
    </ScrollViewer>
</Grid>

Has anyone else experience this, and is there any work around?

© Stack Overflow or respective owner

Related posts about Silverlight