views:

265

answers:

1

Hi, How can I lock vertical scrolling of a ScrollViewer by using the mouse wheel ?

+1  A: 

If I understood you well, you wish to be able to scroll using the vertical scroll bar but not using the mouse wheel.

In this case just catch the mouse wheel event on your ScrollViewer content and mark it as handled:

<ScrollViewer>
    <StackPanel MouseWheel="MyContent_MouseWheel">
        ...
    </StackPanel>
</ScrollViewer>

and in code behind:

private void MyContent_MouseWheel(object sender, MouseWheelEventArgs e)
{
 e.Handled = true;
}
Mart