14.13. HTML Integration

Silverlight has some great functionality that allows you to interact with the web page through something called the HTML bridge. The HTML bridge allows you to modify DOM elements and call JavaScript functions from within your Silverlight application. The reverse is also possible, allowing you to call Silverlight functions from within JavaScript. Note that Silverlight utilizes parts of the DLR (refer to Chapter 3) to perform some of this functionality (Silverlight was one of the first applications to benefit from the DLR).

14.13.1. Calling a JavaScript Function from Silverlight

Select the Chapter14.HelloSilverlight.Web project:

  1. Open ~\Chapter14.HelloSilverlightTestPage.aspx.

  2. Add the following code within the page's <head> ...

Get Introducing .NET 4.0: with Visual Studio 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.