Export (0) Print
Expand All
Expand Minimize

ModifierKeys Enumeration

Specifies the set of modifier keys.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

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

[TypeConverterAttribute(typeof(ModifierKeysConverter))]
[FlagsAttribute]
public enum class ModifierKeys
<object property="oneOrMoreModifierKeys"/>

XAML Values

oneOrMoreModifierKeys

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

Member nameDescription
AltThe ALT key.
ControlThe CTRL key.
NoneNo modifiers are pressed.
ShiftThe SHIFT key.
WindowsThe Windows logo key.

The Modifiers property on the Keyboard class is the set of the modifier keys that are currently pressed.

Some APIs in Windows Presentation Foundation (WPF) that make use of the ModifierKeys enumeration are the Modifiers properties on the Keyboard, KeyBinding, KeyGesture, and MouseGesture classes.

The following example shows how to create a KeyBinding that associates a KeyGesture with a RoutedCommand. The KeyBinding uses the ModifierKeys enumeration to specify the modifier key of the gesture.

<Window.InputBindings>
  <KeyBinding Command="ApplicationCommands.Open"
              Gesture="CTRL+R" />
</Window.InputBindings>
No code example is currently available or this language may not be supported.

.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.

Show:
© 2014 Microsoft