Intersoft.Client.Framework.Input Namespace > CommandManager Class : RegisterClassInputBinding Method |
Public Shared Sub RegisterClassInputBinding( _ ByVal type As Type, _ ByVal inputBinding As InputBinding _ )
Dim type As Type Dim inputBinding As InputBinding CommandManager.RegisterClassInputBinding(type, inputBinding)
public static void RegisterClassInputBinding( Type type, InputBinding inputBinding )
public: static void RegisterClassInputBinding( Type^ type, InputBinding^ inputBinding )
In addition to instance command binding, the commanding framework in ClientUI also supports class command binding API which is available in the CommandManager class. The class input binding is particularly useful when you have a fairly large amount of controls where the key gesture is bound to.
The following code example shows how to use class input binding API to register a key gesture on a specific type rather than an instance.
C# |
Copy Code
|
---|---|
static EditorCommandInterface() { RoutedUICommand[] commands = new RoutedUICommand[] { EditingCommands.Cut, EditingCommands.Copy, EditingCommands.Paste }; // register class-level command binding for each RoutedUICommand foreach (RoutedUICommand command in commands) { CommandManager.RegisterClassCommandBinding( typeof(UXPage), new CommandBinding(command, OnCommandExecuted, OnCanExecute)); } // register class-level input binding System.Windows.Input.ModifierKeys modifiers = System.Windows.Input.ModifierKeys.Control | System.Windows.Input.ModifierKeys.Shift; CommandManager.RegisterClassInputBinding( typeof(UXPage), new InputBinding(EditingCommands.Cut, new KeyGesture(System.Windows.Input.Key.X, modifiers))); CommandManager.RegisterClassInputBinding( typeof(UXPage), new InputBinding(EditingCommands.Copy, new KeyGesture(System.Windows.Input.Key.C, modifiers))); CommandManager.RegisterClassInputBinding( typeof(UXPage), new InputBinding(EditingCommands.Paste, new KeyGesture(System.Windows.Input.Key.V, modifiers))); } |
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2