tags:

views:

45

answers:

1

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?

+1  A: 

Use Attached Behaviors : http://code.msdn.microsoft.com/eventbehaviourfactor

Catalin DICU