The way I created KeyBinding
was something like:
Here is my code to implement multiple character shortcut keys, such as Alt + P + A in WPF MVVM.
Add this to your XAML (attached behavior for the KeyDown event):
cb:ShortCutBehavior.Command="{Binding Shortcuts.CmdKeyPressed}"
Add this to your view model:
ShortCuts Shortcuts = new ShortCuts( this );
//Add Plenty of shortcuts here until your heart is desired
Shortcuts.AddDoubleLetterShortCut( AddOrganization, Key.P, Key.A, ModifierKeys.Alt, true);
Shortcuts.AddSingleLetterShortCut( CmdAddNewAgreement, Key.A, ModifierKeys.Alt);
These are two examples of adding shortcuts. The first is a double letter shortcut: Alt + P + A which runs the method AddOrganization() and the second is a single letter shortcut: Alt + A which executes the ICommand CmdAddNewAgreemnt.
Both AddDoubleLetterShortCut and AddSingleLetterShortCut are overloaded to accept Actions or ICommands.
This is one of my first attempts at generisizing something, so you can take the idea and make it suitable for you.