Partilhar via


MouseBinding.Gesture Propriedade

Definição

Obtém ou define o gesto associado a essa 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 da propriedade

O gesto.

Atributos

Exceções

Gesture é definido como null.

Exemplos

O exemplo a seguir mostra como criar uma associação entre um MouseGesture para um 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)

Comentários

Um MouseGesture é um MouseAction com ou sem um conjunto de ModifierKeys. Ao contrário de um KeyGesture, um MouseGesture não precisa ter uma chave modificadora associada a ela.

Aplica-se a

Confira também