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
Have been able to add Keybinding on the DataGrid level. Like this :
Xaml :
**
**
**
View Model :
public ICommand DeleteCommand
{
get
{
return new DelegateCommand(ExecuteCommand, CanExecute);
}
}
private void ExecuteCommand()
{
// your code to delete here.
YourCollection.Remove(YourSelectedItem);
}
private void CanExecute()
{
// logic to check if the delete command can execute.
return YourSelectedItem != null ;
}