InputGestureCollection.Add(InputGesture) Método

Definición

Agrega el objeto especificado InputGesture a este InputGestureCollectionobjeto .

public:
 int Add(System::Windows::Input::InputGesture ^ inputGesture);
public int Add(System.Windows.Input.InputGesture inputGesture);
member this.Add : System.Windows.Input.InputGesture -> int
Public Function Add (inputGesture As InputGesture) As Integer

Parámetros

inputGesture
InputGesture

Gesto que se va a agregar a la colección.

Devoluciones

0, si la operación se realizó correctamente (tenga en cuenta que no es el índice del elemento agregado).

Excepciones

la colección es de solo lectura.

el gesto es null.

Ejemplos

En el ejemplo siguiente se crea un KeyGesture objeto y se agrega a InputGestureCollection de .RoutedCommand

<Window.InputBindings>
  <KeyBinding Key="B"
              Modifiers="Control" 
              Command="ApplicationCommands.Open" />
</Window.InputBindings>
KeyGesture OpenCmdKeyGesture = new KeyGesture(
    Key.B,
    ModifierKeys.Control);

ApplicationCommands.Open.InputGestures.Add(OpenCmdKeyGesture);
Dim OpenCmdKeyGesture As New KeyGesture(Key.B, ModifierKeys.Control)

ApplicationCommands.Open.InputGestures.Add(OpenCmdKeyGesture)

Se aplica a

Consulte también