【问题标题】:Windows Phone multi-touchWindows Phone 多点触控
【发布时间】:2015-08-07 21:53:38
【问题描述】:

我想在我的 Windows Phone Silverlight 应用程序中创建两个控件,并在按下这两个控件时启动我的计时器。我尝试使用 MouseLeftButtonDown 事件来执行此操作,但它不支持多点触控。释放控制后触发 Tap 事件,所以这不是我想要的。按下控件后一秒钟后触发保持事件 - 我想在同时按下两个控件时立即获取事件。

我怎样才能做到这一点?

【问题讨论】:

  • 您是否尝试过使用“PointerEntered”和“PointerExited”事件?由于无法通过触摸“悬停”在任何东西上,因此只要触摸/不触摸某物,它们就会触发。
  • 我没有这些事件。它们是 Windows Phone 应用程序中的标准事件吗?
  • 查看Manipulation*事件
  • 操纵事件的工作方式与 MouseLeftButton(Down/Up) 相同 - 当我单击控件并按住它时,此控件的 ManipulationStarted 被正确触发,但是当我按下第二个控件时(仍然按住第一个控件),未触发该控件的 ManipulationStarted。
  • 如果Manipulation* 事件对您不起作用,也许较低级别的TouchPoint 可能会有所帮助? c-sharpcorner.com/UploadFile/mahakgupta/…

标签: c# silverlight windows-phone multi-touch


【解决方案1】:

谢谢@Fabian。 我用过接触点

我做了这样的事情并且它有效:

TouchPoint primaryTouchPoint = e.GetPrimaryTouchPoint(mainGrid);
TouchPointCollection touchPoints = e.GetTouchPoints(mainGrid);

foreach (TouchPoint tp in touchPoints)
{
    var controlPosition = myControl.TransformToVisual(Application.Current.RootVisual).Transform(new Point(0, 0));
    if (tp.Action == TouchAction.Down && tp_is_in_myControl)
        do_something;

}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-21
    相关资源
    最近更新 更多