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)

[<TypeConverterAttribute(typeof(ModifierKeysConverter))>]
[<FlagsAttribute>]
type ModifierKeys

Member nameDescription
Alt

The ALT key.

Control

The CTRL key.

None

No modifiers are pressed.

Shift

The SHIFT key.

Windows

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

<object property="oneOrMoreModifierKeys"/>

oneOrMoreModifierKeys

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

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
Available since 3.0
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: