I am working on a WPF application that supports basic touch events (Not Manipulations). I am using Gong DragDrop to handle the drag and drop actions. The issue I ran into is described as follow:
In the [Preview] Drop event (using Gong DragDrop), I show a dialog and prompt the user to confirm the drop location, which user has to click on the "Yes" button to complete the drop or the "No" button to cancel the drop. I can use mouse to click on those two buttons, but no luck with touch events.
I have used spy++ to monitor the mouse events for the prompt dialog, which derived from a window. Both mouse events and the touch events were logged.
Why did the mouse event work and touch didn't? Is there a way to get touch to work?
Apparently this is a bug in WPF. Microsoft have decided to ignore it and have removed the bug report which was here:
https://connect.microsoft.com/VisualStudio/feedback/details/619521/wpf-touch-bug
citing Connect is for future versions, not for fixing bugs source.
This MSDN Forum thread details some poor buggers attempts to deal with Microsoft on the issue. Note upgrading to .Net 4.5.1 with Visual Studio 2013 DOES NOT fix the issue.
He did however find a workaround, which is to open the dialog on a new thread.
Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Send, new Action(delegate
{
var window = new MyWindowView
{
IsManipulationEnabled = true,
Owner = Application.Current.MainWindow,
Topmost = true
};
WindowInteropHelper helper = new WindowInteropHelper(window);
helper.Owner = helper.Handle;
window.ShowDialog();
}));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With