Move the Cursor Away From the RadButton Control
Environment
Product Version | 2020.3.915 |
Product | Buttons for WPF |
Description
Using a device that supports both mouse and touch input, can cause the mouse to go to the tapped location, causing the button to apply a trigger for the IsMouseOver property.
Solution
Subscribe to the TouchUp event of the RadButton control, and use the Win32 API to manually move the cursor away from the button.
[DllImport("User32.dll")]
private static extern bool SetCursorPos(int X, int Y);
private void RadNumericUpDown_TouchUp(object sender, TouchEventArgs e)
{
SetCursorPos(0, 0);
}
<DllImport("User32.dll")>
Private Shared Function SetCursorPos(ByVal X As Integer, ByVal Y As Integer) As Boolean
Private Sub RadNumericUpDown_TouchUp(ByVal sender As Object, ByVal e As TouchEventArgs)
SetCursorPos(0, 0)
End Sub