MouseAction 枚举

定义

指定定义鼠标所执行的操作的常量。Specifies constants that define actions performed by the mouse.

public enum class MouseAction
[System.ComponentModel.TypeConverter(typeof(System.Windows.Input.MouseActionConverter))]
public enum MouseAction
type MouseAction = 
Public Enum MouseAction
继承
MouseAction
属性

字段

LeftClick 1

单击鼠标左键。A left mouse button click.

LeftDoubleClick 5

双击鼠标左键。A left mouse button double-click.

MiddleClick 3

单击鼠标中键。A middle mouse button click.

MiddleDoubleClick 7

双击鼠标中键。A middle mouse button double-click.

None 0

不执行任何操作。No action.

RightClick 2

单击鼠标右键。A right mouse button click.

RightDoubleClick 6

双击鼠标右键。A right mouse button double-click.

WheelClick 4

旋转鼠标滚轮。A mouse wheel rotation.

示例

下面MouseGesture的示例演示如何MouseAction使用枚举值构造, 如何RoutedCommand使用将MouseBinding笔势绑定到。The following example shows how to construct a MouseGesture using a MouseAction enumeration value and how to bind the gesture to a RoutedCommand using a MouseBinding.

<MouseBinding MouseAction="MiddleClick"
              Command="ApplicationCommands.Cut" />
MouseGesture CutCmdMouseGesture = new MouseGesture(
    MouseAction.MiddleClick);

MouseBinding CutMouseBinding = new MouseBinding(
    ApplicationCommands.Cut, 
    CutCmdMouseGesture);

// RootWindow is an instance of Window.
RootWindow.InputBindings.Add(CutMouseBinding);
Dim CutCmdMouseGesture As New MouseGesture(MouseAction.MiddleClick)

Dim CutMouseBinding As New MouseBinding(ApplicationCommands.Cut, CutCmdMouseGesture)

' RootWindow is an instance of Window.
RootWindow.InputBindings.Add(CutMouseBinding)

注解

枚举指定与鼠标执行的操作 ( RightClick如和RightDoubleClick) 相对应的常量。 MouseActionThe MouseAction enumeration specifies constants which correspond to actions performed by the mouse, such as RightClick and RightDoubleClick.

MouseAction可以与MouseGesture结合使用来创建可MouseBinding使用绑定到命令的输入笔势。MouseAction can be used with a MouseGesture to create a input gesture which can be bound to a command using a MouseBinding. 有关命令的详细信息, 请参阅命令概述For more information about commanding, see the Commanding Overview.

适用于

另请参阅