KeyBinding.Gesture Propiedad

Definición

Obtiene o establece el gesto asociado a este 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

Valor de propiedad

Secuencia de teclas. El valor predeterminado es null.

Atributos

Excepciones

El valor gesture que se está estableciendo no es KeyGesture.

Ejemplos

En el ejemplo siguiente se muestra cómo enlazar un KeyGesture objeto a mediante un RoutedCommandKeyBinding objeto (el marcado y los ejemplos de código especifican claves diferentes, pero son equivalentes en caso contrario).

<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 teclas de función y las claves numéricas del teclado, debe KeyGesture contener y Key una o varias ModifierKeys.

Se aplica a

Consulte también