Wednesday, April 20, 2011

How can I catch a symbol that user is hit on keyboard?

Yes, many controls have KeyUp/KeyDown propertys. But in they arguument I can catch Key class only. Not real symbol. For example, when user type "d" symbol is become a Key.D in KeyDown. All symbols in any other langauge that stay on the same plase on keyboard will be Key.D too.

How I can get analog of KeyPress in WPF that can represent a char (symbol) to catch a native typing depended on local langauge?

From stackoverflow
  • read here:
    http://msdn.microsoft.com/en-us/library/ms754010.aspx#text_inputReal
    It seems that what you need to do is to handle the TextInput event rather than the KeyUp/KeyDown events.
    This is probably the same difference as handling WM_CHAR rather than WM_KEYDOWN/WM_KEYUP

    FFire : There is no WM_CHAR or KeyPress event or anything like that in the current Silverlight.
    shoosh : luckly was talking about WPF.

0 comments:

Post a Comment