You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Official mouse events for WM_MOUSEHWHEEL horizontal wheel scrolling are not defined yet #3201
WPF handles WM_MOUSEWHEEL but this is only vertical wheel movement. It also needs to handle WM_MOUSEHWHEEL to handle horizontal wheel movement.
This isn't an obscure request; many of the mice that support horizontal wheel scrolling aren't using a physical wheel per se but a touch sensor on the middle mouse button to track finger scrolling in 4 directions. Another variation is the vertical physical wheel that tilts to the left or right for horizontal scrolling. Visual Studio is a WPF application that supports horizontal mouse scrolling in the editor but obviously not through the framework. We can get this generalized very cheaply.
System.Windows.Input.Mouse has these members for vertical wheel scrolling:
public readonly static RoutedEvent PreviewMouseWheelEvent;
public readonly static RoutedEvent MouseWheelEvent;
It will need to add:
public readonly static RoutedEvent PreviewMouseHorizontalWheelEvent;
public readonly static RoutedEvent MouseHorizontalWheelEvent;
Other public-facing classes that would need to change downwind for this to be generally available:
UIElement
UIElement3D
ContentElement
ScrollViewer
Etc. It's basically uncontroversial boilerplate which is mostly copy-paste of the code for vertical scrolling, with minimal risk of side effects. The vertical and horizontal scrolling could theoretically be combined into a single event to allow diagonal scrolling, but Win32 reports vertical and horizontal scrolling separately from one another. Built-in controls could add high-level support for horizontal wheel scrolling on an ad-hoc basis, but opening this up will allow third-party developers to add support quickly at their own pace.
Reacted by lindexi, Jan Kučera, Bastian Schmidt, Mrxx99, Teng Liu, BADF00D, Shankar, Kevin Smith, Tim Cooke, Elie TAILLARD and 15 more
I do not know whether everyone reading this understands the implications it has to touchpads, so I will throw it in just in case:
Implementing this feature will also take care of this other major sore deficiency that WPF currently has, which is that it does not respond to touchpad events for horizontal scrolling. The underlying layers do translate horizontal scrolling with the touchpad into horizontal-mouse-wheel events, but then WPF goes ahead and completely ignores them, so currently you cannot have horizontal scrolling with a touchpad in WPF. This feature would fix that problem too.
Something to consider if implementing in-built horizontal scrolling for in-built WPF controls, is if it should take into account the delta value to enable a better scrolling experience. (See here for context: #5936.)
Also, there's a standalone single-file implementation (HorizontalWheelFeature.cs)
that adds complete horizontal wheel support and exposes the events on Mouse and UIElement through extension blocks. It supports .NET Framework 4.x through the latest .NET.
@Roshaless As I mentioned in #3201 (comment), I'd prefer adding a property to MouseWheelEventArgs rather than introducing a new type. That said, @miloush thinks this could be a breaking change — handlers that only ever dealt with vertical scrolling would end up handling horizontal scrolling unexpectedly.
Yes I had to implement it recently and it certainly ought to be a separate event, most of the plumbing is already in the codebase. I was going to do PR that @Roshaless did.
Activity
mikenakis commentedon Mar 12, 2023
I do not know whether everyone reading this understands the implications it has to touchpads, so I will throw it in just in case:
Implementing this feature will also take care of this other major sore deficiency that WPF currently has, which is that it does not respond to touchpad events for horizontal scrolling. The underlying layers do translate horizontal scrolling with the touchpad into horizontal-mouse-wheel events, but then WPF goes ahead and completely ignores them, so currently you cannot have horizontal scrolling with a touchpad in WPF. This feature would fix that problem too.
miloush commentedon May 9, 2023
@ClosetBugSlayer do you want to make an API proposal?
aquinn39 commentedon May 9, 2023
Something to consider if implementing in-built horizontal scrolling for in-built WPF controls, is if it should take into account the delta value to enable a better scrolling experience. (See here for context: #5936.)
lindexi commentedon Sep 22, 2023
[API proposal] How about add IsHorizontalMouseWheel property to MouseWheelEventArgs?
https://learn.microsoft.com/en-us/uwp/api/windows.ui.input.pointerpointproperties.ishorizontalmousewheel
miloush commentedon Oct 5, 2023
@lindexi this would make existing vertical code unexpectedly handle horizontal scrolling, see discussion at #5937 (comment)
Add horizontal mouse wheel routed-event backbone
Add horizontal mouse wheel routed-event backbone
Add horizontal mouse wheel routed-event backbone
Add horizontal mouse wheel routed-event backbone
Add horizontal mouse wheel routed-event backbone
Add horizontal mouse wheel routed-event backbone
Add horizontal mouse wheel routed-event backbone
Add horizontal mouse wheel routed-event backbone
Roshaless commentedon Sep 21, 2026
I've opened a PR that implements this.
Also, there's a standalone single-file implementation (HorizontalWheelFeature.cs)
that adds complete horizontal wheel support and exposes the events on
MouseandUIElementthrough extension blocks. It supports .NET Framework 4.x through the latest .NET.lindexi commentedon Sep 22, 2026
@Roshaless As I mentioned in #3201 (comment), I'd prefer adding a property to
MouseWheelEventArgsrather than introducing a new type. That said, @miloush thinks this could be a breaking change — handlers that only ever dealt with vertical scrolling would end up handling horizontal scrolling unexpectedly.miloush commentedon Sep 22, 2026
Yes I had to implement it recently and it certainly ought to be a separate event, most of the plumbing is already in the codebase. I was going to do PR that @Roshaless did.
miloush commentedon Sep 22, 2026
API proposal: #11961