Tuesday, July 28, 2009

Focus a Silverlight control on startup

I found two solutions to this problem on the web and neither of them worked for me. I finally combined both of them to make it work:

In the aspx page, include

<script type="text/javascript">
window.onload = function()
setTimeout(function() { document.getElementById('Xaml1').focus(); }, 1);

And then in Page.cs class as a response to Loaded event:


Labels: ,


Post a Comment

Subscribe to Post Comments [Atom]

<< Home