MouseBinding.Gesture Egenskap
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Hämtar eller anger den gest som är associerad med den här 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
Egenskapsvärde
Gesten.
- Attribut
Undantag
Gesture är inställt på null.
Exempel
I följande exempel visas hur du skapar en bindning mellan en MouseGesture till en 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)
Kommentarer
A MouseGesture är en MouseAction med eller utan en uppsättning med ModifierKeys. Till skillnad från en KeyGesturebehöver en MouseGesture inte ha en modifierarnyckel associerad med den.