Powered by MSDN

US - English
NEW! Silverlight 5 is available Learn More

Set focus on silverlight app RSS

1 reply

Last post Mar 14, 2008 04:50 PM by mhaggag

(0)
  • jackbond

    jackbond

    Contributor

    5812 Points

    1559 Posts

    Set focus on silverlight app

    Mar 14, 2008 02:37 PM | LINK

    Has anybody got a sample of how to set the initial focus for a page to a silverlight app contained in it? I tried the standard ASP.NET Focus with the

    <asp:Silverlight /> control but that didn't work. Thanks in advance.

  • mhaggag

    mhaggag

    Member

    354 Points

    67 Posts

    Re: Set focus on silverlight app

    Mar 14, 2008 04:50 PM | LINK

    If you know the ID of the embedded silverlight object, you can do something like:

    document.getElementById("AgControl1Host").focus();

    Unfortunately, my javascript-fu is extremely weak, so I don't know if that would work across all supported browsers. It does work in IE7, though.

     

    Muhammad Haggag.
    SDE, Silverlight (Text feature team)