MouseAction MouseAction MouseAction MouseAction Enum

Definition

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
Inheritance
Attributes

Fields

LeftClick LeftClick LeftClick LeftClick 1

A left mouse button click.

LeftDoubleClick LeftDoubleClick LeftDoubleClick LeftDoubleClick 5

A left mouse button double-click.

MiddleClick MiddleClick MiddleClick MiddleClick 3

A middle mouse button click.

MiddleDoubleClick MiddleDoubleClick MiddleDoubleClick MiddleDoubleClick 7

A middle mouse button double-click.

None None None None 0

No action.

RightClick RightClick RightClick RightClick 2

A right mouse button click.

RightDoubleClick RightDoubleClick RightDoubleClick RightDoubleClick 6

A right mouse button double-click.

WheelClick WheelClick WheelClick WheelClick 4

A mouse wheel rotation.

Examples

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)

Remarks

The MouseAction enumeration specifies constants which correspond to actions performed by the mouse, such as RightClick and RightDoubleClick.

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.

Applies to

See also