InputBinding Constructor (ICommand^, InputGesture^)
Initializes a new instance of the InputBinding class with the specified command and input gesture.
Assembly: PresentationCore (in PresentationCore.dll)
public:
[SecurityCriticalAttribute]
InputBinding(
ICommand^ command,
InputGesture^ gesture
)
Parameters
- command
-
Type:
System.Windows.Input::ICommand^
The command to associate with gesture.
- gesture
-
Type:
System.Windows.Input::InputGesture^
The input gesture to associate with command.
| Exception | Condition |
|---|---|
| ArgumentNullException | command or gesture is null. |
If you are a software developer using existing input binding classes, you generally will not use this constructor, even if you are defining custom commands. Instead, you will either use constructors of derived classes (KeyBinding and MouseBinding), or you will use this constructor as the base instantiation of a custom class. Although the InputBinding class supports different input devices in principle, in practice you must choose which device the input binding will represent. You only can set only one Gesture value on the input binding, and gestures are device-specific.
The following example shows how to use this constructor to associate a KeyGesture with a RoutedCommand.
Available since 3.0