Windows Phone 上的键字符 [英] Key char on Windows Phone

查看:17
本文介绍了Windows Phone 上的键字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想确定用户通过键盘输入的符号.例如在 Windows 窗体中 KeyPressEventArgs 有 KeyChar 属性,但在 Windows Phone 中 KeyEventArgs 没有这个属性.

I want to determine the symbol that user entered by keypad. For example in Windows Forms KeyPressEventArgs has KeyChar property, but there is no this property for KeyEventArgs in Windows Phone.

需要处理这个事件,因为我想处理一些西里尔符号.

It's needed to handle this event, because i want to handle some cyrillic symbols.

推荐答案

正如你所说的,e.Key 和 e.PlatformKeyCode 不授予成功 - e.Key = Key.Unknown.
但我认为你可以尝试这样做:

As you have said e.Key and e.PlatformKeyCode don't grant success - e.Key = Key.Unknown.
But I think you can try to do like this:

private void myTextbox_KeyUp(object sender, System.Windows.Input.KeyEventArgs e)
{
   char added = myTextbox.Text.ElementAt(myTextbox.Text.Length - 1);
}

当用户输入符号时 - 检查最后添加到文本中的内容,因为我已经检查过它与西里尔文一起使用.然后在同一事件中,您可以使用此文本或符号执行您想要的操作.
我已经在 TextBox 上检查过这个,但我不知道你的问题是否与它有关.

When the users enters symbol - check the last added to text, as I've checked it works with cyrillic. Then in the same event you can do what you want with this text or symbol.
I've checked this on TextBox thought I don't know if your problem is concerned with it.

这篇关于Windows Phone 上的键字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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