In XAML is there way to bind key press and key release to specific commands?

Posted by Ashley Davis on Stack Overflow See other posts from Stack Overflow or by Ashley Davis
Published on 2010-03-24T09:40:09Z Indexed on 2010/03/24 9:43 UTC
Read the original article Hit count: 263

Filed under:
|
|

In my application I have keys that bound to commands using the KeyBinding class. The command is executed when the key is pressed and released.

I have a special case where I want to bind separate commands to the pressed action and to the released action. For example when the space key is pressed I want my app to run a command to enter a special mode. Then when the space key is released I want to run another command to exit that special mode.

Currently I do this by manually handling the KeyUp and KeyDown events. Is there anyway to execute commands for pressed and released purely in XAML?

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf