Silverlight 2, you talk nicely to JavaScript

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 …

Tag:

Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
    Unsubscribing
    Subscribing

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.