New to Telerik UI for WPF? Start a free 30-day trial

This class presents a way to query the state of the various keyboard modifier keys. It also allows you to check the state of the shortcut key for the current platform.

The different platforms Silverlight runs on employ differing input conventions. Thus shortcuts for common actions such as Copy, Paste and Select All are activated using one key on Windows (Control), but using another on Mac OS X (Apple). Using this class should save you tedious platform checks. It is inadvisable, however, to use the IsShortcutKeyDown property before you've researched what the accepted shortcut for the relevant platform is. Even though this class addresses a Silverlight scenario, it will also work on WPF.

Definition

Namespace:Telerik.Windows.Controls

Assembly:Telerik.Windows.Controls.dll

Syntax:

C#
public static class KeyboardModifiers

Inheritance: objectKeyboardModifiers

Properties

Gets a value indicating whether the Alt key is pressed.

C#
public static bool IsAltDown { get; }
Property Value:

true if the Alt key is pressed; otherwise, false.

Gets a value indicating whether the Apple (Command) key is pressed.

C#
public static bool IsCommandDown { get; }
Property Value:

true if the Apple (Command) key is pressed; otherwise, false.

This is only applicable on Silverlight under Mac OS X.

Gets a value indicating whether the Control key is pressed.

C#
public static bool IsControlDown { get; }
Property Value:

true if the Control key is pressed; otherwise, false.

Gets a value indicating whether the Shift key is pressed.

C#
public static bool IsShiftDown { get; }
Property Value:

true if the Shift key is pressed; otherwise, false.

Gets a value indicating whether the platform-specific shortcut meta key is pressed.

C#
public static bool IsShortcutKeyDown { get; }

For most systems (Windows + Linux) the shortcut key is Control. However, under Mac OS X the shortcut key is Apple (Command). Note that you still have to know if the relevant shortcut on Mac uses Command, because it can be entirely different.

Modifiers

ModifierKeys

Gets the keyboard modifier keys.

C#
public static ModifierKeys Modifiers { get; }