MouseGesture.Modifiers Property

Gets or sets the modifier keys associated with this MouseGesture.

Namespace:  System.Windows.Input
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation

'Declaration
Public Property Modifiers As ModifierKeys
<object Modifiers="oneOrMoreModifierKeys"/>

XAML Values

oneOrMoreModifierKeys

One or more modifier keys, defined by the ModifierKeys enumeration, delimited with a "+" character.

Property Value

Type: System.Windows.Input.ModifierKeys
The modifier keys associated with this gesture. The default value is None.

Unlike a KeyGesture, a MouseAction does not have to be paired with ModifierKeys in order to be a valid MouseGesture.

ModifierKeys is a bit field enumeration, so it is possible for multiple modifier keys to be pressed at the same time. Use bit operations to determine the exact set of modifier keys pressed.

The following example shows to create a MouseGesture and associate it with a RoutedCommand through a MouseBinding.

			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)

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft