2017-04-10 76 views
1

在WPF4中,可以通过调用ManipulationDeltaEventArgs.Cancel()来取消操作事件并将其转发回鼠标事件。相当于操作的UWP删除

我希望能够在UWP/Windows10中做同样的事情,但ManipulationDeltaRoutedEventArgs上没有这种取消方法。

MSDN文档是指cancellation of a manipulation ...

操控手势事件,如在ManipulationStarted,表明一个持续的互动。当用户触摸一个元素并继续直到用户抬起他们的手指,或者操作被取消时,它们开始发射。

......但并没有告诉你如何实际上做到这一点:?

+0

有你累致电*完整的()* - 在[MSDN说](https://msdn.microsoft.com/en-us/library/system.windows.uielement.manipulationstarted(V = VS .110).aspx):'通过调用Complete方法取消操作 – Romasz

回答

2

您可以在您定位的UIElement上取消它。

element.ManipulationDelta += OnManipulationDelta; 

... 

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

    element.CancelDirectManipulations(); 
}