UWP Equivalent to ManipulationDelta Cancel

In WPF4, it is possible to cancel a manipulation event and forward it back to mouse events by calling ManipulationDeltaEventArgs.Cancel().

I'd like to be able to do the same thing in UWP / Windows10, but there is no such cancel method on ManipulationDeltaRoutedEventArgs.

The MSDN documentation refers to cancellation of a manipulation ...

Manipulation gesture events, such as ManipulationStarted, indicate an ongoing interaction. They start firing when the user touches an element and continue until the user lifts their finger(s), or the manipulation is canceled.

... but doesn't tell you how you can actually do it :?

Upvotes: 1

Views: 142

Answers (1)

Laith
Laith

Reputation: 6091

You can cancel it on the UIElement you've targeted.

element.ManipulationDelta += OnManipulationDelta;

...

private void OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs e)
{
    var element = (UIElement)sender;

    element.CancelDirectManipulations();
}

Upvotes: 2

Related Questions