KeyBinding.Gesture Właściwość

Definicja

Pobiera lub ustawia gest skojarzony z tym KeyBindingelementem .

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

Wartość właściwości

Sekwencja kluczy. Wartość domyślna to null.

Atrybuty

Wyjątki

wartość gesture jest ustawiana na wartość nie jest wartością KeyGesture.

Przykłady

W poniższym przykładzie pokazano, jak powiązać element z KeyGesture użyciem RoutedCommandKeyBinding (przykłady znaczników i kodu określają różne klucze, ale są w przeciwnym razie równoważne).

<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)

Uwagi

Z wyjątkiem kluczy funkcji i kluczy klawiatury liczbowej, KeyGesture musi zawierać element Key i i co najmniej ModifierKeysjeden .

Dotyczy

Zobacz też