Mega Code Archive
Create RoutedCommand from InputGestureCollection
//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace Commands
{
public partial class Window1 : Window
{
RoutedCommand myCmd;
Window1()
{
InputGestureCollection myInputs = new InputGestureCollection();
myInputs.Add(new KeyGesture(Key.G,ModifierKeys.Control | ModifierKeys.Shift));
myCmd = new RoutedCommand("Go", typeof(Window1), myInputs);
}
private void ExecuteCommandClickEvent(object sender, RoutedEventArgs e)
{
myCmd.Execute(sender,null);
}
}
}