Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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;
 }


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.
Posted
Updated 10-Feb-11 11:14am
v2

1 solution

You can use an InputScope to do this.

XML
<TextBox Height="72" Width="392"
         Margin="33,44,0,0" InputScope="PersonalFullName"
         VerticalAlignment="Top" HorizontalAlignment="Left">
</TextBox>
 
Share this answer
 
v2
Comments
DeepsMann 12-Feb-11 3:36am    
Thanks
DeepsMann 18-Feb-11 0:30am    
hye,

In the application in WP7 i m working,
I have a textbox whose place holder text is "Enter Here"
As i click on the textbox it gets blank and i can write some text
and click on the button to navigate to some other page.

Now i want that the text "Enter Here" or its any combination in Lower and Upper Case
like- "Enter here", "enter Here", "EnTer Here", "ENTER here" "Enter HERE" etc should not be a valid text and one cannot navigate to other page.

Now i have tried, but it was too long and not a good approach.

What should i do.
is there any way to make all posiible combinations of a text.

Thanks in advance.
DeepsMann 18-Feb-11 5:43am    
i got it.

it can be done as-

if (!("enter here".Equals(textBox1.Text.Trim(), StringComparison.OrdinalIgnoreCase)))
{
// code
}
{

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900