MouseGesture.Modifiers 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置与此 MouseGesture 关联的修改键。
public:
property System::Windows::Input::ModifierKeys Modifiers { System::Windows::Input::ModifierKeys get(); void set(System::Windows::Input::ModifierKeys value); };
public System.Windows.Input.ModifierKeys Modifiers { get; set; }
member this.Modifiers : System.Windows.Input.ModifierKeys with get, set
Public Property Modifiers As ModifierKeys
属性值
与此笔势关联的修改键。 默认值是 None。
示例
下面的示例演示如何创建 , MouseGesture 并通过 将其与 RoutedCommandMouseBinding关联。
MouseGesture OpenCmdMouseGesture = new MouseGesture();
OpenCmdMouseGesture.MouseAction = MouseAction.WheelClick;
OpenCmdMouseGesture.Modifiers = ModifierKeys.Control;
MouseBinding OpenCmdMouseBinding = new MouseBinding();
OpenCmdMouseBinding.Gesture = OpenCmdMouseGesture;
OpenCmdMouseBinding.Command = ApplicationCommands.Open;
this.InputBindings.Add(OpenCmdMouseBinding);
Dim OpenCmdMouseGesture As New MouseGesture()
OpenCmdMouseGesture.MouseAction = MouseAction.WheelClick
OpenCmdMouseGesture.Modifiers = ModifierKeys.Control
Dim OpenCmdMouseBinding As New MouseBinding()
OpenCmdMouseBinding.Gesture = OpenCmdMouseGesture
OpenCmdMouseBinding.Command = ApplicationCommands.Open
Me.InputBindings.Add(OpenCmdMouseBinding)
注解
与 不同, KeyGestureMouseAction 不必与 ModifierKeys 配对即可成为有效的 MouseGesture。
ModifierKeys 是位字段枚举,因此可以同时按下多个修饰键。 使用位运算来确定按下的确切修改键集。
XAML 属性用法
<object Modifiers="oneOrMoreModifierKeys"/>
XAML 值
oneOrMoreModifierKeys
一个或多个修改键,由 ModifierKeys 枚举定义,用“+”字符分隔。