Sdílet prostřednictvím


ModifierKeys Enumeration

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
<FlagsAttribute> _
Public Enumeration ModifierKeys
[FlagsAttribute]
public enum ModifierKeys

Members

Member name Description
Supported by Silverlight for Windows Phone None No modifiers are pressed.
Supported by Silverlight for Windows Phone Alt The ALT key is pressed.
Supported by Silverlight for Windows Phone Control The CTRL key is pressed.
Supported by Silverlight for Windows Phone Shift The SHIFT key is pressed.
Supported by Silverlight for Windows Phone Windows The Windows logo key is pressed.
Supported by Silverlight for Windows Phone Apple The Apple key (also known as the Open Apple key) is pressed.

Remarks

Silverlight is a cross-platform technology. Certain values of this enumeration will only logically originate from certain operating systems.

This is a flags enumeration. If multiple modifier keys are pressed, bitwise comparisons against the value will return true, and you can also directly check for equalities of key combinations in operations by adding the values, for instance to check if CTRL+ALT is pressed.

ModifierKeys does not typically have a XAML usage. ModifierKeys is generally only used for code, and bitwise comparisons of values from Keyboard.Modifiers that are checked from a key-related or command-related event handler. If keys that are traditionally modifiers need to be specified in XAML, you should use Key.

The enumeration constants Apple and Windows are deliberately assigned to the same underlying value. Because of the platform dependencies, the two enumeration values will never coincide, and also because of the platform characteristics the two values have somewhat equivalent meanings. Your handler can choose to take advantage of this implementation detail by checking for either Apple or Windows. If you use the recommended technique of bitwise comparison, this is already the behavior.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.