views:

27

answers:

1

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?

+1  A: 

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.

Sascha
Sounds like a good idea. I knew a disciple should eventually help me... :)I'll make a mental note of that for the future. In this case I have mostly command-bound buttons, but I also have a button or two that just triggers a fade animation to another thing in the same control. For now I just use an Opacity animation to hide the buttons behind an almost invisible filter grid.It has a Background="#017F7F7F" and a converter I use to hide controls with Opacity=0:Visibility="{Binding Opacity, RelativeSource={x:Static RelativeSource.Self}, Converter={StaticResource opacityToVisibility}}"It works
xyzzer
Will add more details in another question I'll post later.
xyzzer