如何获得WinRT中的密钥 [英] How to get the Key Pressed in WinRT

查看:193
本文介绍了如何获得WinRT中的密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用OnTextInput事件来获取WPF / Silverlight中的最终用户按下的密钥,但是在WinRT的情况下,我没有这样的事件,我遇到了KeyDown事件。虽然事件会返回用户按下的密钥,但是由于事件返回VirtualKey枚举,因此我无法区分大小写(例如,大写或小写)。

I had used OnTextInput Event to get the Key Pressed by the end user in WPF/Silverlight, but in case of WinRT I dont have such events and I am struck with KeyDown Event. Though the event returns the Key Pressed by the User, I am not able to differentiate the case (i.e, lower or upper case) as the event returns VirtualKey Enum.

是有任何可能的解决方法?

Is there any possible workarounds?

Regards

推荐答案

很多WinRT程序员有这个问题,事件只是不是很可见。微软对于此事件的命名一直不够。它是Winforms中的KeyPress,WPF中的TextInput。 WinRT的另一个选择,它是 CharacterReceived 事件。

Lots of WinRT programmers have this problem, the event just isn't very discoverable. Microsoft hasn't been consistent enough about naming this event. It is KeyPress in Winforms, TextInput in WPF. Yet another choice for WinRT, it is the CharacterReceived event.

这篇关于如何获得WinRT中的密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆