Windows Phone 7中的自动大写 [英] Auto Capitalization in Windows Phone 7

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

问题描述



在我的文本框的textchanged事件中,我编写了代码,以使首位字符大写,但是我遇到一个问题,因为每次从textchanged事件调用返回时,它都会将文本框放在开头. />
以下是我的代码

Hi,

At the textchanged event of my textbox, I have written code so that the character at first position get capitalised, but I am having one issue, as each time it returns from the textchanged event call, it focuses the textbox at the start.

Following is my code

int len = txtIdeaName.Text;

 if (len == 1)
 {
     //this capitalize the first character 
     string str = txtIdeaName.Text.ToUpper();
     txtIdeaName.Text = str;
 }
 if (len > 1)
 {
     string s1 = txtIdeaName.Text.Substring(0, 1).ToUpper();
     string s2 = txtIdeaName.Text.Substring(1, len-1).ToLower();
     string str = s1 + s2;
     txtIdeaName.Text = str;
 }



有什么方法可以自动将文本框中的第一个字符大写吗?
另外,在我的WP7设备设置中,自动大写为ON.
但在我的应用程序中不起作用.手机设置在用户的应用程序中不起作用吗?

当我的文本框获得焦点时,如何打开大写锁定或SIP上的向上箭头.

有什么办法吗?
我有Key.Capslock属性,但它只可读不写

谢谢.



Is there any way to auto-capitalize the first character in a textbox?
Also, in my WP7 device setting, auto-capitalization is ON.
but it doesn''t works in my application. Is it the case that the phone settings doesn''t works in Users'' applications?

How can I turn on the caps-lock or the up arrow on SIP as my textbox gets focus.

Is there any way to do this?
I got Key.Capslock property, but it is only readable not writeable

Thanks.

推荐答案

您可以使用InputScope 进行此操作.

You can use an InputScope to do this.

<TextBox Height="72" Width="392"

         Margin="33,44,0,0" InputScope="PersonalFullName"

         VerticalAlignment="Top" HorizontalAlignment="Left">
</TextBox>


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

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