开发者

How to best disable multitouch on buttons in WPF?

开发者 https://www.devze.com 2023-01-07 20:18 出处:网络
I am working on a Surface application and I have a problem with multiple buttons getting pressed at the same time.

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 开发者_如何学JAVAanimations 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消