views:

20

answers:

1

I have multiple text boxes on a silverlight page. How can I make one of them active so that I will not have to click it to be able to type into it.

+1  A: 

You could try

    textBox1.Focus();

This tries to bring the focus over your textbox.

EDIT: I assume that you want to select your textbox when the page is loaded. In this situation you nead to bring the focus to the silverlight plug-in first and after that to call Focus() method of your textbox.

Here a way to do this:

    System.Windows.Browser.HtmlPage.Plugin.Focus();
Koynov
I already tried that. I do textBox1.Focus() and I run the solution, if I start typing nothing happens... so I still have to click on the textbox
Andrei T. Ursan
You could check the update of my answer. HTH
Koynov
In IE works, but in chrome it doesn't. I think this is because silverlight has a little bit of support problems with chrome. dunno.Anyway I'm marking your answer as the solution.Thank you!
Andrei T. Ursan