Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8143935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:14:34+00:00 2026-06-06T13:14:34+00:00

When my Silverlight page loads, I want to set focus on a control. Simple

  • 0

When my Silverlight page loads, I want to set focus on a control. Simple problem with a not-so-obvious solution.

I tried the following with no luck. The page loads but my control does not have focus.

public MainPage()
{
    InitializeComponent();

    if( !DesignerProperties.IsInDesignTool )
    {
        // some init code goes here...

        this.Loaded += ( s, e ) =>
            {
                this.InitFocus();
            };
    }
}

private void InitFocus()
{
    this.PropNumTextBox.Focus();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:14:35+00:00Added an answer on June 6, 2026 at 1:14 pm

    The solution is to use System.Windows.Browser.HtmlPage.Plugin.Focus(). When I call this prior to calling Focus on my initial control, it works as expected. The correct code looks as follows:

    public MainPage()
    {
        InitializeComponent();
    
        if( !DesignerProperties.IsInDesignTool )
        {
            // init code here...
    
            this.Loaded += ( s, e ) =>
                {
                    this.InitFocus();
                };
        }
    }
    
    private void InitFocus()
    {
        // this call is necessary to initialize focus on page load
        System.Windows.Browser.HtmlPage.Plugin.Focus();
        this.PropNumTextBox.Focus();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can i do the following in a silverlight page/app? (Note: the silverlight app will
I'm playing with Silverlight 4, and I when my page loads, I call beginGet(my/people/,
In side a Silverlight Page, I want to redirect to another aspx page in
I have a form and want to set the initial focus to a text
I use WebBrowser Silverlight 4 control to load some page: <WebBrowser Height=350 Name=webBrowser Width=400
I have a silverlight control that has a Frame on it. I want to
I've used an object tag to load my Silverlight control because I want to
Previously, I was passing information to a Silverlight control inside of the Page_Load method.
in my silverlight page I am fetching the data through WCF WCF is returning
Ok, so this question probably isn't Silverlight specific. I have a silverlight 2 page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.