Comparteix a través de


MouseBinding.Gesture Propiedad

Definición

Obtiene o establece el gesto asociado a este MouseBinding.

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.MouseGestureConverter))]
public override System.Windows.Input.InputGesture Gesture { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Input.MouseGestureConverter))>]
member this.Gesture : System.Windows.Input.InputGesture with get, set
Public Overrides Property Gesture As InputGesture

Valor de propiedad

El gesto.

Atributos

Excepciones

El valor de Gesture está establecido en null.

Ejemplos

En el ejemplo siguiente se muestra cómo crear un enlace entre un objeto MouseGesture a .RoutedCommand

<MouseBinding Gesture="Alt+MiddleClick"
              Command="ApplicationCommands.New" />
MouseGesture NewCmdMouseGesture = new MouseGesture();
NewCmdMouseGesture.Modifiers = ModifierKeys.Alt;
NewCmdMouseGesture.MouseAction = MouseAction.MiddleClick;

MouseBinding NewMouseBinding = new MouseBinding();
NewMouseBinding.Command = ApplicationCommands.New;
NewMouseBinding.Gesture = NewCmdMouseGesture;

// RootWindow is an instance of Window.
RootWindow.InputBindings.Add(NewMouseBinding);
Dim NewCmdMouseGesture As New MouseGesture()
NewCmdMouseGesture.Modifiers = ModifierKeys.Alt
NewCmdMouseGesture.MouseAction = MouseAction.MiddleClick

Dim NewMouseBinding As New MouseBinding()
NewMouseBinding.Command = ApplicationCommands.[New]
NewMouseBinding.Gesture = NewCmdMouseGesture

' RootWindow is an instance of Window.
RootWindow.InputBindings.Add(NewMouseBinding)

Comentarios

Un MouseGesture es un MouseAction objeto con o sin un conjunto de ModifierKeys. A diferencia de , KeyGestureMouseGesture no es necesario tener una clave modificadora asociada.

Se aplica a

Consulte también