I need a simple way to set a shortcut for menu items.
But this don´t work with shortcut, just with click:
<
This work for me
Code behind:
private void ContextMenu_PreviewKeyUp(object sender, KeyEventArgs e) { ContextMenu contextMenu = sender as ContextMenu; if (e.Key == Key.D) { //DELETE ID } contextMenu.IsOpen = false; }