【问题标题】:UWP Equivalent to ManipulationDelta CancelUWP 相当于 ManipulationDelta 取消
【发布时间】:2017-04-11 07:02:06
【问题描述】:

在 WPF4 中,可以通过调用 ManipulationDeltaEventArgs.Cancel() 取消操作事件并将其转发回鼠标事件。

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

MSDN 文档参考cancellation of a manipulation ...

ManipulationStarted 等操作手势事件表示正在进行的交互。当用户触摸一个元素时它们开始触发并持续到用户抬起手指或操作被取消

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

【问题讨论】:

  • 你是否累了调用Complete() - MSDN says: Cancel the manipulation by calling the Complete method.

标签: uwp win-universal-app


【解决方案1】:

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

element.ManipulationDelta += OnManipulationDelta;

...

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

    element.CancelDirectManipulations();
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-08-29
    • 1970-01-01
    • 1970-01-01
    • 2010-11-20
    • 2018-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多