There are several events which deal with manipulation (and thus drag&drop):
- ManipulationStarting
- ManipulationStarted
- ManipulationDelta
- ManipulationInertiaStarting
- ManipulationCompleted
In the ManipulationStarting event, the event args (type ManipulationStartingRoutedEventArgs) allow me to set the Mode attribute to ManipulationModes.None -- is it correct that this means that no manipulation is allowed and thus no drag&drop?
I'm asking because I've come across a strange behaviour when I was playing with the official XAML user input events sample application, especially with scenario 4 (drag&drop).
Just set the Mode to ManipulationModes.None in the ManipulationStarting event of Scenario4.xaml.cs:
void ManipulateMe_ManipulationStarting(object sender, ManipulationStartingRoutedEventArgs e)
{
forceManipulationsToEnd = false;
e.Mode = ManipulationModes.None; // <-- this is new
e.Handled = true;
}
Nevertheless, with every third drag attempt I can drag the rectangle around. I've recorded a video to demonstrate this: http://www.youtube.com/watch?v=psytuTailHg.
This problem does not only occur with this sample but also in my own application.
Questions:
- Why is there such a strange behavior?
- What's the best way to cancel the drag&drop event (for instance if some conditions are not met)?