KeyBinding.Gesture Propiedad

Definición

Obtiene o establece el gesto asociado a este KeyBindingobjeto .

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

Valor de propiedad

Secuencia de claves. El valor por defecto es null.

Atributos

Excepciones

el valor gesture se establece en no es .KeyGesture

Ejemplos

En el ejemplo siguiente se muestra cómo enlazar un KeyGesture objeto a RoutedCommand mediante un KeyBinding objeto (los ejemplos de marcado y código especifican claves diferentes, pero son equivalentes de otro modo).

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

Comentarios

Con la excepción de las claves de función y las claves del teclado numérico, debe KeyGesture contener y Key uno o varios ModifierKeys.

Se aplica a

Consulte también