After installing .Net 4.5.2 Microsoft's recommended method of disabling WPF tablet support fails. The source code for this approach is shown below:
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();
//stylusLogicType.InvokeMember("EnableCore", BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.NonPublic, null, stylusLogic, null);
// 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 });
}
}
}
}
Specifically, the function never exits the "while (devices.Count > 0)" loop because the call that invokes the member function "OnTabletRemoved" appears to fail.
In comments I have tried adding a call to "EnableCore" thinking that this might kick start the rest to work.
How can this be resolved? Hundreds of commercial WPF applications will simply hang without an indication of the nature of their failure if this problem is not resolved ASAP.