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 do dodania do kolekcji.

Zwraca

0, jeśli operacja zakończyła się pomyślnie (zwróć uwagę, ż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 elementu 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ż