0

I have several controls in my silverlight view including telerik and my own controls(Custom controls).in this view there is a TextBox called AppointmentSubject which needs to be focused when i open this view.this textbox is also a custom control.I did following thing inside the View_Loaded method.

    System.Windows.Browser.HtmlPage.Plugin.Focus();
    //TextBoxName.Focus()
    AppointmentSubject.Focus();

But AppointmentSubject only gets focused when i open the view second time.Any idea how i achieve it right first time?

Daryl
  • 339
  • 1
  • 5
  • 17
  • Possible duplicate of [How Do I Give a Textbox Focus in Silverlight?](http://stackoverflow.com/questions/124649/how-do-i-give-a-textbox-focus-in-silverlight) – matt Nov 23 '15 at 15:51
  • If you have other controls that grab focus the very moment they loaded, it could well be one of those other controls grabs it from your TextBox. I always tell people to **not** grab focus _onLoaded_ because of this. Better to place `foo.Focus()` in code that is triggering the view creation for `foo` in the first place. – Martin Nov 23 '15 at 17:21

0 Answers0