Condividi tramite


MouseBinding.Gesture Proprietà

Definizione

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

Valore della proprietà

Movimento.

Attributi

Eccezioni

Gesture è impostato su null.

Esempio

Nell'esempio seguente viene illustrato come creare un'associazione tra un MouseGesture oggetto a un oggetto 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)

Commenti

Un MouseGesture oggetto è un MouseAction oggetto con o senza un set di ModifierKeys. A differenza di un KeyGestureoggetto , non MouseGesture è necessario che sia associata una chiave di modifica.

Si applica a

Vedi anche