InputGestureCollection.Add(InputGesture) Metodo

Definizione

Aggiunge l'entità InputGesture specificata a questo oggetto 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

Parametri

inputGesture
InputGesture

Il movimento da aggiungere all'insieme.

Restituisce

0, se l'operazione ha successo (non si tratta dell'indice dell'elemento aggiunto).

Eccezioni

L'insieme è in sola lettura.

Il movimento è null.

Esempio

Nell'esempio seguente viene creato un oggetto KeyGesture e viene aggiunto all'oggetto InputGestureCollection di un oggetto 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)

Si applica a

Vedi anche