InputGestureCollection.Add(InputGesture) Método

Definição

Adiciona o especificado InputGesture a isso 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 a ser adicionado à coleção.

Retornos

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

Exceções

a coleção é somente leitura.

o gesto é null.

Exemplos

O exemplo a seguir cria um KeyGesture e adiciona-o InputGestureCollection ao 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

Confira também