Search code examples
c#wpfsliderwacomstylus-pen

Thumb not dragging immediately with wacom board in WPF Slider


I've created a new WPF application in Visual Studio (.Net 4.5) and just added a Slider to the MainWindow:

<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Class="SliderTest.MainWindow"
        Title="MainWindow">

    <StackPanel>
        <Slider />
    </StackPanel>
</Window>

If I use a Wacom board with Windows Ink enabled and try to drag the thumb, the thumb will be dragged only after a certain noticeable threshold (say 50px).

If Windows Ink is disabled (in the Wacom properties), the thumb is moved immediately as expected.

This problem has been reported also here and here.

This issue has apparently been a problem for many Wacom users, but for me it's not an option to disable Ink.

My understanding is that Slider (and Thumb) don't handle stylus events directly, but instead "wait" for them to be routed and bubbled and followed by mouse events see images in this blog post to see the concept illustrated.

Any idea on how to fix the Slider behavior with Ink enabled?


Solution

  • I wasn't able to find a decent fix for Slider, so I've decided to build my own custom slider.

    In it, I handle mouse and stylus events separately, distinguishing mouse events coming from the mouse from those coming from the stylus by checking if StylusDevice is null in MouseEventArgs.