MouseBinding.Gesture Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the gesture associated with this 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
Property Value
The gesture.
- Attributes
Exceptions
Gesture is set to null
.
Examples
The following example show how to create a binding between a MouseGesture to 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)
Remarks
A MouseGesture is a MouseAction with or without a set of ModifierKeys. Unlike a KeyGesture, a MouseGesture does not need to have a modifier key associated with it.
Applies to
See also
Sodelujte z nami v storitvi GitHub
Vir za to vsebino najdete v storitvi GitHub, kjer lahko tudi ustvarite in pregledate težave in zahtevke za uveljavitev sprememb. Če želite več informacij, glejte naš vodnik za sodelavce.