To use your own commands:

public class DataCommands { public static RoutedCommand Delete { get; set;} public static RoutedCommand Edit { get; set; } static DataCommands() { InputGestureCollection inputs = new InputGestureCollection(); inputs.Add(new KeyGesture(Key.E, ModifierKeys.Control, "Ctrl+E")); edit = new RoutedCommand("Edit", typeof(DataCommands), inputs); inputs = new InputGestureCollection(); inputs.Add(new KeyGesture(Key.D, ModifierKeys.Control, "Ctrl+D")); delete = new RoutedCommand("Delete", typeof(DataCommands), inputs); } } 

Added a link on the page where I will use:

 xmlns:command="clr-namespace:WpfApplProject.Commands" 

And how now to add these two commands to the collection of commands:

 <Page.CommandBindings> <CommandBinding Command="Undo" Executed="UndoCommandBinding_Executed" CanExecute="SaveCommandBinding_CanExecute" /> //Библиотечная команда </Page.CommandBindings> 

    1 answer 1

    So write:

      <!-- для команды Edit --> <CommandBinding Command="command:DataCommands.Edit" ... />