Intersoft ClientUI Documentation
RegisterClassInputBinding Method (CommandManager)



The type to register inputBinding with.
The input binding to register.
Registers the specified InputBinding with the specified type.
Syntax
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
) 

Parameters

type
The type to register inputBinding with.
inputBinding
The input binding to register.
Remarks

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)));
        }

For a more complete version of this example, see How-to: Implement Rich Editor Command Interface with ToolBar, MenuBar and ContextMenus.
Requirements

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

See Also

Reference

CommandManager Class
CommandManager Members

Send Feedback