Läs på engelska Redigera

Dela via


MouseAction Enum

Definition

Specifies constants that define actions performed by the mouse.

C#
[System.ComponentModel.TypeConverter(typeof(System.Windows.Input.MouseActionConverter))]
public enum MouseAction
Inheritance
MouseAction
Attributes

Fields

Name Value Description
None 0

No action.

LeftClick 1

A left mouse button click.

RightClick 2

A right mouse button click.

MiddleClick 3

A middle mouse button click.

WheelClick 4

A mouse wheel rotation.

LeftDoubleClick 5

A left mouse button double-click.

RightDoubleClick 6

A right mouse button double-click.

MiddleDoubleClick 7

A middle mouse button double-click.

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.

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

MouseBinding CutMouseBinding = 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

Produkt Versioner
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also