Social Icons

Thursday, January 19, 2012

How to set focus to a text box in silver light application

In Microsoft silver light you can set focus to the text in following way.

private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (App.Current.IsRunningOutOfBrowser)
            {
                txtSalesOrderNo.Focus(); 
            }
            else
            {
                System.Windows.Browser.HtmlPage.Plugin.Focus();
                txtSalesOrderNo.Focus(); 
            }

        }

No comments:

Post a Comment

 

Sample text

Sample Text