Binding a WPF ShortCut Key to a Command in the ViewModel
问题 I have a WPF app that is using the MVVM pattern. Hooking up buttons to the VM is pretty straight forward since they implement the ICommand. I have a context menu that works similar. The next step is to create shortcut keys for the context menu. I can't figure out how to get the shortcut key invoke the Command. Here is an example: <MenuItem Header="Update" Command="{Binding btnUpdate}" > <MenuItem.Icon> <Image Source="/Images/Update.png" Width="16" Height="16" /> </MenuItem.Icon> </MenuItem>