Touching a WPF button does sometimes not invoke the click handler under Windows 8 Touching a WPF button does sometimes not invoke the click handler under Windows 8 wpf wpf

Touching a WPF button does sometimes not invoke the click handler under Windows 8


It has turned out to be a BUG in WPF. There is a workaround available until a KB is released.

The workaround is to call Mouse.Synchronize(); in the PreviewTouchDown event handler of the affected UIElement of MainWindow.

I tested it and it works fine.


I had the same issue and found that disabling the RealTimeStylus (effectivly disabling touch support) worked for me and resulted in mouse events always being raised on touch.

We were using an industrial touchscreen with multitouch support on Windows 10.

https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/disable-the-realtimestylus-for-wpf-applications

public static void DisableWPFTabletSupport()  {      // Get a collection of the tablet devices for this window.        TabletDeviceCollection devices = System.Windows.Input.Tablet.TabletDevices;      if (devices.Count > 0)      {             // Get the Type of InputManager.          Type inputManagerType = typeof(System.Windows.Input.InputManager);          // Call the StylusLogic method on the InputManager.Current instance.          object stylusLogic = inputManagerType.InvokeMember("StylusLogic",                      BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.NonPublic,                      null, InputManager.Current, null);          if (stylusLogic != null)          {              //  Get the type of the stylusLogic returned from the call to StylusLogic.              Type stylusLogicType = stylusLogic.GetType();              // Loop until there are no more devices to remove.              while (devices.Count > 0)              {                  // Remove the first tablet device in the devices collection.                  stylusLogicType.InvokeMember("OnTabletRemoved",                          BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.NonPublic,                          null, stylusLogic, new object[] { (uint)0 });              }                          }      }  }