1
votes

In my program page I need to scroll vertically and inside (this ScrollViewer) in a specific place to do horizontal scroll. The problem is that when I point with my mouse on the inside ScrollViewer area I cant scroll the page (vertically).

The code structure looks like this:

<ScrollViewer HorizontalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" VerticalScrollBarVisibility="Visible" CanContentScroll="True" Margin="0,0,10,46">
    ...
<ScrollViewer Grid.Row="3" Grid.ColumnSpan="5" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" CanContentScroll="True" HorizontalAlignment="Center" VerticalAlignment="Stretch"  Margin="0 0 0 32">
    ...
    </ScrollViewer>
    ...
    </ScrollViewer>

I hope you can help me.

This is a picture of what im doing: (the red is the outer ScrollViewer and the purple is the inner ScrollViewer) enter image description here

1
A ScrollViewer will always handle the mouse wheel events. Even if it doesn't need to. Any solution to this will require a custom ContentControl implementation. - Gusdor

1 Answers

2
votes

You can prevent inner ScrollViewer from handling mousewheel as described here - https://serialseb.com/blog/2007/09/03/wpf-tips-6-preventing-scrollviewer-from/