InputGestureCollection.Add(InputGesture) Método

Definição

Adiciona o especificado InputGesture a este InputGestureCollection.

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

O gesto para acrescentar à coleção.

Devoluções

0, se a operação tiver sido bem-sucedida (note-se que este não é o índice do item adicionado).

Exceções

A coleção é só de leitura.

O gesto é null.

Exemplos

O exemplo seguinte cria um KeyGesture e adiciona-o ao InputGestureCollection de um 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)

Aplica-se a

Ver também