This is a mirror of official site: http://jasper-net.blogspot.com/

Silverlight and JavaScript Interop Basics

| Monday, December 13, 2010
I've been looking into Silverlight in my spare time a bit, to see what it has to offer, and the JavaScript "Interop" is actually pretty neat and simple to use. About three months ago I wrote a post titled "Working with HTML DOM in Silverlight using the Bridge Pattern"; so I think this time I'll go over some of the basics involved with communicating back and forth between Silverlight and JavaScript. This article is written by referencing Silverlight 2 Beta 2, but should still hold relevent in the final release of Silverlight 2.

Call a JavaScript Methods from within Silverlight

1) Using the Eval method

Silverlight does expose the JavaScript Eval method, so you can use it to call some JavaScript in the page

2) Using the Invoke method

You can use the Invoke method to execute some global JavaScript method within your page.

Returning Values From JavaScript Method Calls
Returning Objects From JavaScript Method Calls and Accessing Its Methods and Properties
Call Silverlight Methods From JavaScript

Read more: Chris Pietschmann

Posted via email from .NET Info

0 comments: