MouseBinding.Gesture 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置与此 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
属性值
笔势。
- 属性
例外
将 Gesture 设置为 null
。
示例
以下示例演示如何在 和 之间MouseGestureRoutedCommand创建绑定。
<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)
注解
是 MouseGesture 具有 MouseAction 或不带一组 的 ModifierKeys。 与 不同, KeyGesture不需要 MouseGesture 具有与之关联的修饰键。