Click here to Skip to main content
14,925,975 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm developing a Universal App in c# for Windows 8.1

I'm trying to catch physical keyboard input and from the on-line literature have been pointed to KeyDown event and KeyRoutedEventArgs and the Key property. This works fine for most key characters and returns VirtualKey enumerations such as VirtualKey.A. However, when characters such as ,.;:> are pressed the Key property is set to a number and this number is the same value if the key is pressed in combination with VirtualKey.Shift which seems to indicate it is not representative of the characters on the key, but only represents the physical key.

As it happens, I'm using an Italian laptop keyboard which of course is laid out differently to a UK Extended keyboard so the Key value for a semicolon (;) is 186 on a UK keyboard (as an un-Shifted or bottom character) and is 188 on an Italian keyboard (as a Shift or top character). I'm therefore stumped as far a capturing these punctuation characters.

I have developed WPF, Silverlight and .Net app in the past and don't remember it being as difficult to handle physical keyboard input even in combination a game loop, as I just used the Key or Keys enumeration and an OEM value.

How can I capture these punctuation characters when their respective key is pressed, irrespective of the keyboard layout?
Posted

1 solution

Characters typed on a physical keyboard are exposed by this event:
http://msdn.microsoft.com/en-us/library/windows.ui.core.corewindow.characterreceived.aspx
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900