KeyBinding.Gesture Properti

Definisi

Mendapatkan atau mengatur gerakan yang terkait dengan ini KeyBinding.

public:
 virtual property System::Windows::Input::InputGesture ^ Gesture { System::Windows::Input::InputGesture ^ get(); void set(System::Windows::Input::InputGesture ^ value); };
[System.ComponentModel.TypeConverter(typeof(System.Windows.Input.KeyGestureConverter))]
public override System.Windows.Input.InputGesture Gesture { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Input.KeyGestureConverter))>]
member this.Gesture : System.Windows.Input.InputGesture with get, set
Public Overrides Property Gesture As InputGesture

Nilai Properti

Urutan kunci. Nilai defaultnya adalah null.

Atribut

Pengecualian

nilai gesture sedang diatur ke bukan .KeyGesture

Contoh

Contoh berikut menunjukkan cara mengikat KeyGestureRoutedCommand menggunakan KeyBinding (contoh markup dan kode menentukan kunci yang berbeda tetapi setara).

<Window.InputBindings>
  <KeyBinding Command="ApplicationCommands.Open"
              Gesture="CTRL+R" />
</Window.InputBindings>
KeyGesture CloseCmdKeyGesture = new KeyGesture(
    Key.L, ModifierKeys.Alt);

KeyBinding CloseKeyBinding = new KeyBinding(
    ApplicationCommands.Close, CloseCmdKeyGesture);

this.InputBindings.Add(CloseKeyBinding);
Dim CloseCmdKeyGesture As New KeyGesture(Key.L, ModifierKeys.Alt)

Dim CloseKeyBinding As New KeyBinding(ApplicationCommands.Close, CloseCmdKeyGesture)

Me.InputBindings.Add(CloseKeyBinding)

Keterangan

Dengan pengecualian kunci fungsi dan kunci keypad numerik, harus KeyGesture berisi Key dan satu atau beberapa ModifierKeys.

Berlaku untuk

Lihat juga