如何最好地禁用 WPF 中按钮上的多点触控?

发布于 2024-09-10 17:30:19 字数 267 浏览 1 评论 0原文

我正在开发 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

闻呓 2024-09-17 17:30:20

如果您绑定到自定义命令,您可以通过

bool CanExecute

“返回”

false

使按钮无法按下来控制它。那些没有命令的必须按照传统方式处理。

If you bind to a custom command you can control this via

bool CanExecute

Returning

false

makes the button not press able. Those without commands must be handled traditionally.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文