I'm using a textbox on my Windows Phone 8 app. I want that the first character which will be insert by the user will be in upper case.

        if (str.Length == 1)
            str = str.ToUpper();

I've tried to handle TextChanged event on Textbox with the above code, but the cursor will move to the first position, so I can't insert more text at the right place.

So, how can I make the first letter of textbox to upper case?

有帮助吗?

解决方案

You should set the InputScope property to Text. The first character will automatically be inserted in upper case, and the TextBox will get auto-correction, suggestions, and emoticons.

<TextBox InputScope="Text" />
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top