Skip Navigation LinksHome / Tips / View Tip

Tip: How to invoke a JavaScript function from the Silverlight?

+ Add to SilverlightShow Favorites
0 comments   /   posted by Martin Mihaylov on Sep 09, 2008
(1 votes)
Categories: General

In order to invoke a JavaScript function  we must access the DOM from the Silverlight application. This can be done with the help of the System.Windows.Browser.HtmlPage class. Here it is how it's done:

HtmlPage.Window.Invoke( "Function_Name", new object[] { //Array of paramaters that must be passed to the function } );

We call the Invoke method of the Window property, which takes the name of the function and an array of its arguments as parameters.

That's it!

Share


Comments

Comments RSS RSS
No comments

Add Comment

 
 

   
  
  
   
Please add 2 and 6 and type the answer here:

Join the free SilverlightShow webcast 'Running Silverlight Outside the Browser and with Elevated Trust'. Sept 7th, 8 am - 9 am PDT.
In this live session Chris Anderson will cover configuring and debugging OOB mode, toast notifications, elevated trust, direct file access and much more.
Learn more | Register | See more webinars (hide this)