Allow a GridView to scroll horizontally using mouse wheel
I'm developping an application that needs a sort of timeline.
It can be very long. So I want to be able to scroll horizontally using mouse wheel or the bottom scrollbar, and also vertically using the right scrollbar. I also need to be able to select items in the timeline, so I used a GridView with a Canvas inside the ItemsPanel.
It works well, except on one point : when I use the mouse wheel, the GridView scrolls vertically. I would like it to scroll horizontally instead.
The solution of disabling vertical scrolling is not an option, because I need to be able to scroll vertically using the right scrollbar.
The solution of using a panel with Orientation="Horizontal" is also not an option because I need a Canvas.
Implementing horizontal scrolling with the PointerWheelChanged Event and calling MouseWheelLeft and MouseWheelRight on the ScrollContentPresenter works but the list also scrolls vertically. The vertical scrolling behavior can't be disabled.
Please provide an API to change the mouse wheel scrolling orientation when using a non oriented panel like Canvas or Grid.
Nicolas Séveno commented
Some sample XAML code can be found on this stackoverflow question :