Silverlight 2, you talk nicely to JavaScript

Published 01 October 08 03:20 PM | Coding4Fun 

talkNicely As some may know, Silverlight 2 has made the shift from being JavaScript to .Net.  But what happens when you still want to make a client-side JavaScript call?

Jeff Blankenburg shows off exactly how to do call JavaScript from Silverlight 2!

Jeff shows off the sample of getting the first 500 primes using JavaScript, he called the function getPrimes().  Then all he had to do in Silverlight’s file was this:

C#:

HtmlPage.Window.Invoke("getPrimes");

VB:

System.Windows.Browser.HtmlPage.Window.Invoke("getPrimes")

 

Jeff even shows how to get return values too!  If you want to pass in additional parameters, you can do that too.  Head over to MSDN, they have a more detailed breakdown on calling JS from managed code and calling managed code from JS.

Now you two languages play nicely else I’ll pull this car over so fast …

Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required

Search

This Blog

Syndication

Page view tracker