Question

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?

Était-ce utile?

La solution

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" />
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top