Pages

Thursday, April 8, 2010

Setting Foucs on a Textbox when the Silverlight page loads

 

I found this on silverlight.net, and was able to get it to work for me by adding a call to System.Windows.Browser.HtmlPage.Plugin.Focus() prior to calling RegularTextBox.Focus():

 

private void UserControl_Loaded(object sender, RoutedEventArgs e)
   {       
      System.Windows.Browser.HtmlPage.Plugin.Focus();
      RegularTextBox.Focus();
   }

0 comments: