9
votes

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?

1
Touch is not working or after Drag and Drop, Touch is not working? - Sankarann
Touch wouldn't work in the dialog that was created from the Drag and Drop. Once the dialog is closed (using mouse), touch works fine. Thanks. - Ming
Sorry, I should elaborate some more. I am using Gong DragDrop v.0.1.3.11, which is compatible with MVVM pattern. As for the MVVM pattern, I am using MVVMLight. During the drop event, gong dragdrop library calls a method from the viewmodel (through interface and other things). The method that Gong dragdrop called contains codes that would send a message (using Messenger) to the GUI controller to generate a dialog that would prompt the user to confirm the drop location. Somehow the buttons on that dialog are not responding to the touch, but those buttons works w. the mouse clicks. Thanks again. - Ming
So the sequence goes like this: Drop event in Gong dragdrop calls a method in the ViewModel ---> ViewModel sends message to the GUI controller ---> Gui Controller creates a dialog. In the dialog control, mouse works, touch doesn't. Hope this make some sense. :) - Ming
Also facing a similar issue, right after a DragDrop, all the buttons available on the current screen are not detecting touch events, I have to do a small pan (touch and move) and the buttons now detect touch events. Seems the control doing the DragDrop is listening too long on some Preview events not allowing to bubble to Touch ones :/ - Kohen Holms

1 Answers

3
votes

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();
}));