Hi, In WPF application I am currently trying to bind a Command to launch a calculator Tool form any where in the application using shortcut keys, I have created a command but not getting how to map commands and shortcut keys to create universal shortcut keys in my application. Thanks in advance.
+3
A:
You can do this in xaml - see the example in the documentation for the KeyBinding class:
<Window.InputBindings>
<KeyBinding Command="ApplicationCommands.Open"
Gesture="CTRL+R" />
</Window.InputBindings>
Update: Looks like you can't actually bind a KeyBinding to a ViewModel using just xaml if you're using MVVM: see here http://stackoverflow.com/questions/1023960/keybinding-a-relaycommand.
Groky
2009-08-23 20:45:01
Do you mean XAML rather than MXML? I think MXML is for Flex.
Andy
2009-08-24 11:52:45
Oops, yes I do! Too many technologies in my head! Fixed, thanks.
Groky
2009-08-24 12:51:27