Skip to main content

Microsoft Silverlight

Answered Question How can I tell in javascript when a silverlight control is fully loaded?RSS Feed

(0)

bpeters
bpeters

Member

Member

1 points

10 Posts

How can I tell in javascript when a silverlight control is fully loaded?

I have a page that dynamically creates a silverlight control, using the provided function "Silverlight.createObjectEx."

This generally works fine, but I'm running into a problem.  I need to load the control, and then have javascript make a call into the control to pass in some data.  The problem is that if I create the object, and then immediately call the exposed function, I get an exception on the page.  If I put in a hack to have javascript sleep for a few seconds,and then I make the same call into the silverlight object, it works as expected. 

Is there any way to detect when a silverlight control is ready for the containing page to communciate with it via javascript? 

Thanks

ccoombs
ccoombs

Contributor

Contributor

5168 points

758 Posts

Answered Question

Re: How can I tell in javascript when a silverlight control is fully loaded?

 perhaps someone has a more 'official' solution, but it seems like you'd be able to invoke a javascript function with Browser.HtmlPage.Window.Eval("someJavascriptFunction();") in the Loaded event of Page.xaml.

the loaded event fires when the silverlight object is loaded and ready for interaction.  then of course 'someJavascriptFunction' would be able to interact with it.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities