I need to get Google Chrome to focus my silverlight component. With firefox and IE my focus can be easily gained using the code shown at the end of question. The code is located at the MainPage which is the first page loaded at the startup.
I need to get focus in login dialog after first page is loaded. Then user writes his username and password etc. Without automatic focus user has to click login dialog, which is a nuisance.
With other browsers I can get focus to the plugin using method call:
I am using Silverlight 4 and C#.
Could you help me, please?
private void UserControl_Loaded(object sender, RoutedEventArgs e)
// Use dispatcher to avoid silly SL 3 problem. Using SL 3
// code had to call UpdateLayout method before focus.
this.Dispatcher.BeginInvoke(() => myTextBox.Focus());
// Get focus to SL component at web page