Ensure Your Silverlight App Has Focus When The Page Loads

Assuming that your SL app is running in-browser, you may want your SL app to have initial focus, e.g. when it loads a splash screen, the OK button has focus.

You can help achieve this by using System.Windows.Browser.HtmlPage.Plugin.Focus(); in your loaded event handler for your usercontrol\childwindow, e.g.:

 

        private void ChildWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // ensure SL plugin has focus
            System.Windows.Browser.HtmlPage.Plugin.Focus();
        }

SHARE:

Comments (9) -

  • barbeque

    3/19/2010 12:39:41 PM | Reply

    This is a really good read for me. Must admit that you are one of the coolest bloggers I ever saw. Thanks for posting this useful article.

  • Automatic Coffee Makers

    3/19/2010 12:47:58 PM | Reply

    This is my first time i visit here. I found so many interesting stuff in your blog, especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the leisure here! Keep up the excellent work.

  • Errol Echard

    3/19/2010 3:30:58 PM | Reply

    If you don't mind me asking I just wanted to ask on what is the difference between blogenenigne and wordpress blogs? Is it easier to use or more efficient? I amseeing a lot of blogs powered by this software popping up lately and wondering if it is better or not? Thanks...

  • Reciprocating Saws

    3/19/2010 9:16:08 PM | Reply

    Hi, I can’t figure out how to add your website in my rss reader. Can you Help me, please? I really want to read your future posts.

  • breville juicer

    3/20/2010 12:53:50 AM | Reply

    I am a regular reader of your site and would just like to say thanks! I have even been inspired to setup my own blog.

  • Industrial Machinery

    3/22/2010 4:40:14 AM | Reply

    We would be interested in advertising on this site. Can you please contact us? Thanks

  • e-cig machines

    3/23/2010 1:32:27 PM | Reply

    Resources like the one u named here will be very usable to me! I will place a link to this website on my website.

Add comment

Loading