在Windows Phone按键字符 [英] Key char on Windows Phone

查看:140
本文介绍了在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不授予成功 - 电子。重点= 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);
}

当用户进入符号 - 检查,最后添加的文字,因为我'已经确认它与西里尔。然后在同一事件中,你可以做你想做这个文字或符号的东西。

我已经在文本框中选中该以为我不知道,如果你的问题是有关的。

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天全站免登陆