InputGestureCollection.Add(InputGesture) Metoda

Definicja

Dodaje określony InputGesture element do tego InputGestureCollectionelementu .

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

Parametry

inputGesture
InputGesture

Gest dodawania do kolekcji.

Zwraca

0, jeśli operacja zakończyła się pomyślnie (pamiętaj, że nie jest to indeks dodanego elementu).

Wyjątki

kolekcja jest tylko do odczytu.

gest to null.

Przykłady

Poniższy przykład tworzy obiekt KeyGesture i dodaje go do InputGestureCollection obiektu 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)

Dotyczy

Zobacz też