Intersoft ClientUI Documentation
RegisterClassInputBinding Method
See Also  Send Feedback
Intersoft.Client.Framework.Input Namespace > CommandManager Class : RegisterClassInputBinding Method






type
The type to register inputBinding with.
inputBinding
The input binding to register.
Registers the specified InputBinding with the specified type.

Syntax

Visual Basic (Declaration) 
Public Shared Sub RegisterClassInputBinding( _
   ByVal type As Type, _
   ByVal inputBinding As InputBinding _
) 
Visual Basic (Usage)Copy Code
Dim type As Type
Dim inputBinding As InputBinding
 
CommandManager.RegisterClassInputBinding(type, inputBinding)
C# 
public static void RegisterClassInputBinding( 
   Type type,
   InputBinding inputBinding
)
Delphi 
public procedure RegisterClassInputBinding( 
    type: Type;
    inputBinding: InputBinding
); static; 
JScript 
public static function RegisterClassInputBinding( 
   type : Type,
   inputBinding : InputBinding
);
Managed Extensions for C++ 
public: static void RegisterClassInputBinding( 
   Type* type,
   InputBinding* inputBinding
) 
C++/CLI 
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 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2012 All Rights Reserved.