Clicking the middle mouse button (aka: mouse wheel) and then moving the mouse down slightly lets users scroll in IE, and most Windows apps. This behavior appears to be missing in WPF controls by default? Is there a setting, a workaround, or something obvious that I’m missing?
Clicking the middle mouse button (aka: mouse wheel) and then moving the mouse down
Share
I have found how to achieve this using 3 mouse events (
MouseDown,MouseUp,MouseMove). Their handlers are attached to theScrollViewerelement in the xaml below:It would be better to write a behaviour instead of events in code-behind, but not everyone has the necessary library, and also I don’t know how to connect it with the
Canvas.The event handlers:
If to remove the method calls
AddScrollSignandRemoveScrollSignthis example will work. But I have extended it with 2 methods which set scroll icon:Example of icons:


And one last remark: there are some problems with the way
Press -> Immediately Release -> Move. It is supposed to cancel scrolling if a user clicks the mouse left button, or any key of keyboard, or the application looses focus. There are many events and I don’t have time to handle them all.But standard way
Press -> Move -> Releaseworks without problems.