KeyBinding.Gesture Proprietà

Definizione

Ottiene o imposta il movimento associato all'oggetto 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

Valore della proprietà

Sequenza di tasti. Il valore predefinito è null.

Attributi

Eccezioni

il valore gesture impostato su non è un oggetto KeyGesture.

Esempio

Nell'esempio seguente viene illustrato come associare un KeyGesture oggetto a usando un RoutedCommandKeyBinding oggetto ( il markup e gli esempi di codice specificano chiavi diverse ma sono altrimenti equivalenti).

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

Commenti

Ad eccezione dei tasti funzione e del tastierino numerico, un KeyGesture oggetto deve contenere un Key e uno o più ModifierKeys.

Si applica a

Vedi anche