Skip to content

Official mouse events for WM_MOUSEHWHEEL horizontal wheel scrolling are not defined yet #3201

Open

Description

@ClosetBugSlayer

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.

Activity

  1. added
    Enhancement Requested
    on Jul 1, 2020
  2. added this to the Future milestone on Jul 1, 2020
  3. mikenakis commented on Mar 12, 2023

    @mikenakis

    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.

  4. miloush commented on May 9, 2023

    @miloush
    Contributor

    @ClosetBugSlayer do you want to make an API proposal?

  5. aquinn39 commented on May 9, 2023

    @aquinn39

    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.)

  6. lindexi commented on Sep 22, 2023

    @lindexi
    Member
  7. miloush commented on Oct 5, 2023

    @miloush
    Contributor

    @lindexi this would make existing vertical code unexpectedly handle horizontal scrolling, see discussion at #5937 (comment)

  8. added 8 commits that reference this issue on Jun 18, 2026
    ef6babd
    9756ada
    bf94adb
    b2c98d9
    f74d5cb
    235507f
    d3dbcd6
    5e1cf89
  9. Roshaless commented on Sep 21, 2026

    @Roshaless

    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 Mouse and
    UIElement through extension blocks. It supports .NET Framework 4.x through the latest .NET.

  10. lindexi commented on Sep 22, 2026

    @lindexi
    Member

    @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.

  11. miloush commented on Sep 22, 2026

    @miloush
    Contributor

    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.

  12. miloush commented on Sep 22, 2026

    @miloush
    Contributor

    API proposal: #11961

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🚧 work in progressEnhancement Requested

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions