KeyEventArgs.PlatformKeyCode Property
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Gets an integer value that represents the key that is pressed or released (depending on which event is raised). This value is the nonportable key code, which is operating system–specific.
Namespace: System.Windows.Input
Assembly: System.Windows (in System.Windows.dll)
Syntax
'Declaration
Public ReadOnly Property PlatformKeyCode As Integer
public int PlatformKeyCode { get; }
Property Value
Type: System.Int32
The key code value.
Remarks
The portable key codes are a common subset of all the possible key codes of the supported operating systems, in this case, Macintosh and Windows. For example, the keystroke 'v' is represented as a Key value (which would evaluate as 51 if you cast it to an integer, but is more useful if you retain the enumeration information). That key would have a PlatformKeyCode value of 86. Certain keystrokes, however, are not portable, such as the SCROLL LOCK key for Microsoft Windows. In this case, the Key value is Unknown, which is the value for any nonportable key, and the PlatformKeyCode is 145 on a Windows platform. For information about Microsoft Windows-specific key codes, see "Virtual-Key Codes" in the MSDN Library. For information on Macintosh-specific key codes, see Keyboard Layout Services Reference on the Apple Developer Connection Web site.
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.