How can I translate what we get in the KeyDown event to a Unicode character?

The KeyDown event in the TextBox (for example) will handle the keyboard event and update the control before the CharacterReceived event is fired in the CoreWindow (in fact, it will do so before the KeyDown event is fired in the CoreWindow ). The TextBox and other controls also do not have any CharacterReceived event .

Because of this, you need to handle the TextBox :: KeyDown event to do filtering or other keyboard event handling.

The KeyDown event seems to be a direct mapping to the Win32 WM_KEYDOWN message as it gives us the scancode of the keyboard key pressed and a few other things. In WPF and Win32, we will use the MapVirtualKey () function to convert the event information to a unicode character.

How do I do this in Windows RT?

+3


source to share


1 answer


There is no MapVirtualKey function. The only information I found on this is that you need to keep track of variables like shift key (kanji key, etc. For foreign languages) with bools, in keydown and keyup events, and then make a massive case toggle that will take all the variables and spit out what you want for your application. Here's a microsoft page that covers some of the basics:



http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh868246.aspx

+2


source







All Articles