如何最好地禁用 WPF 中按钮上的多点触控?
我正在开发 Surface 应用程序,并且遇到同时按下多个按钮的问题。
我有一个带有几个按钮的菜单控件。其中一些绑定到命令,使托管窗口淡出菜单控件并运行其他内容,而另一些则仅连接到在菜单控件的不同视图状态中淡出的事件触发器。问题是,在 Surface 上,您甚至可以同时按下 10 个按钮,这会导致奇怪的效果,因此我想在无限期地按下某个按钮时禁用控件上的所有按钮,或者直到淡入淡出动画完成为止,并且可能会阻止多个按钮按钮进入按下状态。
有什么好主意还是我应该手动处理所有触摸输入和状态机?
I am working on a Surface application and I have a problem with multiple buttons getting pressed at the same time.
I have a menu control with a few buttons. Some of them are bound to Commands that make the hosting window fade out the menu control and run something else, while some are just hooked up to EventTriggers that fade through different view-states of the menu control. The problem is that on Surface you can even press 10 buttons at the same time, which causes freak effects, so I would like to disable all buttons on my control when one is pressed indefinitely or until fade animations are complete and possibly prevent more than one button to go into pressed state.
Any neat ideas or should I just handle all touch inputs and state machine manually?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您绑定到自定义命令,您可以通过
“返回”
使按钮无法按下来控制它。那些没有命令的必须按照传统方式处理。
If you bind to a custom command you can control this via
Returning
makes the button not press able. Those without commands must be handled traditionally.