Partager via


Working with Hardware Keyboards (Windows Phone)

Some, but not all, Windows Phone devices feature hardware keyboards. These keyboards can be accessed using XNA Game Studio in the same manner as hardware keyboards for Xbox 360 or Windows are accessed. There is one major caveat, however, shared by Xbox 360: XNA Game Studio provides no way to determine whether the device has a hardware keyboard, or whether it is currently enabled (open in the case of a slide-style keyboard).

For Windows Phone, the Keys enumeration maps the following members to special keys:

Windows Phone key Keys enumeration member
Accent key Keys.F1
Emoticon key Keys.F2
Symbol key Keys.F3
Vib key Keys.F4
Fn key Keys.LeftShift

All other keys are assigned as described in Keys.

For information about detecting hardware key presses, and for code examples see Detecting a Key Press (Windows, Windows Phone, Xbox 360).

Note

If you are interested in retrieving characters typed—such as when you want text input from the user— instead of the key state, you should use Guide.BeginShowKeyboardInput as described in Displaying a Software Input Panel (Windows Phone, Xbox 360). This process displays a software keyboard that can be used on devices with or without a hardware keyboard, and returns the characters typed.

See Also

Input Overviews