This project has moved and is read-only. For the latest updates, please go here.


Jan 15, 2010 at 5:43 PM

Haven't tried it yet, but I don't see any explicit support for binding RelayCommands to KeyBinding's or CommandBindings mentioned in MVVM Light.  Am I missing anything?

Jan 20, 2010 at 10:50 AM


No you are not missing anything, this is correct.

There are some ways around the lack of KeyBinding: Use an EventToCommand to map the Window's KeyDown event to a command, and pass the EventArgs to the command using the EventToCommand.PassEventArgsToCommand property and setting it to true. I show how to do this for a SL4 drag&drop event here:

This works for KeyDown events too.

For CommandBinding: This is a feature I want to add in a next version. I will think if there is a work around more practical than to define your own event in the Window and calling the Command on the VM directly. Maybe I find a behavior somewhere to do that (in a temporary manner).




Mar 2, 2010 at 2:51 AM


How could I bind short key to my commands? For example:

<KeyBinding Command="{Binding MyCommand}" Key="F4" Modifiers="ALT" />

Mar 25, 2010 at 11:56 AM


Sorry for the delay in the reply.

This is possible in WPF4, but not in WPF3.5SP1. I would recommend to upgrade if you can. WPF4 makes many things much easier, performs better and the runtime is smaller.



Mar 25, 2010 at 11:57 AM

One more thing: If you really cannot upgrade to WPF4, check Mark Smith's library:,guid,8b3e4279-70a5-431e-8fa3-4c1e047df311.aspx

He has some helpers that allow you to do what you need.