【问题标题】:Some multitouch locations are not being detected in wp7 silverlight在 wp7 silverlight 中未检测到某些多点触控位置
【发布时间】:2011-10-29 20:33:27
【问题描述】:

您好,我正在尝试在 silverlight 中为 wp7 创建一个简单的鼓机应用程序。我发现,当我同时(或几乎同时)在 2 个不同位置点击屏幕时,大约 60% 的时间没有检测到其中一个位置。

我已将 Layoutroot 网格连接起来,以便在操作开始时引发事件,如下所示。问题是大约 60% 的时间,当我同时按下分配给高帽的屏幕部分和分配给底鼓或军鼓的屏幕部分时,只按下这些声音之一的触摸位置将在触摸屏中捕获。

我正在测试运行芒果的 LG 擎天柱。关于如何解决这个问题的任何想法?轮询而不是引发事件会产生更好的结果吗?我是否更愿意将此应用程序创建为 XNA 游戏而不是 silverlight 应用程序?任何帮助或想法将不胜感激。

<Grid x:Name="LayoutRoot" Background="Transparent" ManipulationStarted="LayoutRoot_ManipulationStarted"> 

【问题讨论】:

  • 事实证明轮询而不是引发事件解决了这个问题。

标签: silverlight windows-phone-7 xna multi-touch windows-phone-7.1


【解决方案1】:

我在列表框项和上下文菜单方面遇到了类似的问题。 我是这样修复的:

将您的根帧附加到 MouseLeftButtonDown="LayoutRoot_MouseLeftButtonDown"

此事件总是 100% 引发。

在事件点clickPoint = e.GetPosition(null);

现在是时候识别位于这些屏幕坐标处的对象(如果有)。

下面是我识别列表框项的代码。您可以将它与您自己的 UI 对象一起使用:

        ListBoxItem listBoxItem = null;
        List<UIElement> listControls = (List<UIElement>)VisualTreeHelper.FindElementsInHostCoordinates(clickPoint , this);
        foreach (UIElement ctrl in listControls)
        {
            if (ctrl is ListBoxItem)
            {
                listBoxItem = (ListBoxItem)ctrl;
                break;
            }
        }
        //get the index of the selected listboxitem.
        ListBox view = ItemsControl.ItemsControlFromItemContainer(listBoxItem) as ListBox;

干杯, 弗拉德

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-12
    • 1970-01-01
    • 1970-01-01
    • 2013-11-12
    • 1970-01-01
    相关资源
    最近更新 更多