Share via


InputGestureCollection.Add(InputGesture) Metode

Definisi

Menambahkan yang ditentukan InputGesture ke ini 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

Parameter

inputGesture
InputGesture

Gerakan untuk ditambahkan ke koleksi.

Mengembalikan

0, jika operasi berhasil (perhatikan bahwa ini bukan indeks item yang ditambahkan).

Pengecualian

koleksi bersifat baca-saja.

gerakannya adalah null.

Contoh

Contoh berikut membuat KeyGesture dan menambahkannya ke InputGestureCollection dari 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)

Berlaku untuk

Lihat juga