InputBinding.Gesture Propiedad

Definición

Obtiene o establece el InputGesture asociado a este enlace de entrada.Gets or sets the InputGesture associated with this input binding.

public:
 virtual property System::Windows::Input::InputGesture ^ Gesture { System::Windows::Input::InputGesture ^ get(); void set(System::Windows::Input::InputGesture ^ value); };
public virtual System.Windows.Input.InputGesture Gesture { get; set; }
[set: System.Security.SecurityCritical]
public virtual System.Windows.Input.InputGesture Gesture { get; set; }
member this.Gesture : System.Windows.Input.InputGesture with get, set
[<set: System.Security.SecurityCritical>]
member this.Gesture : System.Windows.Input.InputGesture with get, set
Public Overridable Property Gesture As InputGesture

Valor de propiedad

InputGesture

El gesto asociado.The associated gesture. De manera predeterminada, es null.The default is null.

Atributos

Ejemplos

En el ejemplo siguiente se muestra cómo utilizar un KeyBinding para enlazar un KeyGesture a un RoutedCommand .The following example shows how to use a KeyBinding to bind a KeyGesture to a RoutedCommand. Cuando KeyGesture se presiona Alt + L, Close se invoca el comando.When the KeyGesture ALT+L is pressed, the Close command is invoked.

<KeyBinding Modifiers="Alt"
            Key="L"
            Command="ApplicationCommands.Close" />
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

El gesto de entrada es la acción que invoca el comando.The input gesture is the action that invokes the command. Ejemplos de gestos de entrada en WPF son KeyGesture y MouseGesture .Examples of input gestures in WPF are KeyGesture and MouseGesture. KeyGestureEs una combinación de Key y un conjunto de ModifierKeys .A KeyGesture is a combination of a Key and a set of ModifierKeys. MouseGestureEs una combinación de MouseAction y un conjunto de ModifierKeys .A MouseGesture is a combination of a MouseAction and a set of ModifierKeys.

La InputBinding propia clase no admite el uso de XAML, porque no expone un constructor sin parámetros público (hay un constructor sin parámetros, pero está protegido).The InputBinding class itself does not support XAML usage, because it does not expose a public parameterless constructor (there is a parameterless constructor, but it is protected). Sin embargo, las clases derivadas pueden exponer un constructor público y, por tanto, pueden establecer las propiedades que se heredan de InputBinding con un uso de XAML.However, derived classes can expose a public constructor and thus can set properties that are inherited from InputBinding with a XAML usage. Dos InputBinding clases derivadas existentes de las que se pueden crear instancias en XAML y pueden establecer propiedades en XAML son KeyBinding y MouseBinding .Two existing InputBinding derived classes that can be instantiated in XAML and can set properties in XAML are KeyBinding and MouseBinding.

Uso de atributos XAMLXAML Attribute Usage

<KeyBindingGesture= " KeyGesture "/><KeyBinding Gesture="KeyGesture"/>

o bien-or-

<MouseBindingGesture= " MouseGesture "/><MouseBinding Gesture="MouseGesture"/>

o bien-or-

<inputBindingDerivedClass``Gesture= " InputGesture "/><inputBindingDerivedClass Gesture="InputGesture"/>

Uso de elementos de propiedad XAMLXAML Property Element Usage

<inputBindingDerivedClass>  
  <inputBindingDerivedClass.Gesture>  
    <inputGestureImplementation/>  
  </inputBindingDerivedClass.Gesture>  
</inputBindingDerivedClass>  

Valores XAMLXAML Values

inputBindingDerivedClass
Una clase derivada de InputBinding que admite la sintaxis de elementos de objeto, como KeyBinding o MouseBinding .A derived class of InputBinding that supports object element syntax, such as KeyBinding or MouseBinding. Vea la sección Comentarios.See Remarks.

inputGestureImplementation
Una clase derivada personalizada de InputGesture que admite la sintaxis de elemento de objeto.A custom derived class of InputGesture that supports object element syntax.

Se aplica a

Consulte también