似乎无法从 Windows Phone 7 中的 TouchPanel 获取触摸输入
我已经在 Visual Studio 中启动了一个新项目,并一直在尝试使用静态 TouchPanel 类来获取输入。我已通过 EnabledGestures 属性启用了“点击”手势,但是当我点击屏幕时,手势未注册(即 TouchPanel.IsGestureAvailable 返回 false)。
其他诸如 Mouse.GetState().LeftButton == ButtonState.Pressed 之类的事情从未被证明是正确的,即使在我之前的项目(基于 Microsoft 示例项目)中它总是可以正常工作而没有任何问题。
有人知道为什么我似乎无法从设备获得任何形式的输入吗?
I've started a new project in Visual Studio and have been trying to use the static TouchPanel class to get input. I have enabled the 'Tap' gesture through the EnabledGestures property, however when I tap the screen the gesture does not register (i.e. TouchPanel.IsGestureAvailable returns false).
Other things such as Mouse.GetState().LeftButton == ButtonState.Pressed do not ever prove true even though in my previous project (which was based on a Microsoft sample project) it always worked without any problems.
Anyone have any ideas why I can't seem to be able to get any form of input from the device?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下是我的设置方法 - 在页面构造函数中设置手势类型:
然后,在主网格的 XAML 标记中,我将其链接到 ManipulationCompleted 事件处理程序:
同一个事件处理程序中:
然后,在 银光项目。在 XNA 中,您还必须在构造函数中添加手势类型:
然后在 Update 方法中您有相同的验证:
Here is how I set it up - in the page constructor I set the gesture type:
Then, in the XAML markup for the main grid I link it to a ManipulationCompleted event handler:
Then, in the same event handler:
Works for me in a Silverlight project. In XNA, you would have to add the gesture types also in the constructor:
Then in the Update method you have the same verification: