tags:

views:

634

answers:

1

I am looking for a tunneling Button.Click event. The ButtonBase.Click event is bubbling and therefore the root can handle the event only after the action that was registered for that button already occurred (too late for what I need).

I need the counterpart "preview" event, so that I can handle the event before the event that is registered to the button occurs.
I am not sure such event exists, so if it doens't I would be happy to hear some workarounds.

+2  A: 

There is no Button.PreviewClick event. You might try using Button.PreviewMouseDown or Button.PreviewMouseUp to see if that would work for what you're trying to do.

Andy
+1 this is the way it is implemented now. But I'm really looking for a more comperhansive solution. This solution doesn't handle keyboard click, for example.
Elad
The thing is that there isn't any other more comprehensive solution. The only other option that I can think of is to subclass Button and implement the tunneling event yourself. Either that or handle PreviewKeyDown, too.
Andy