Chapter 9. Programming Silverlight Applications with JavaScript
When Silverlight 1.0 was released, unmanaged JavaScript was the only method of adding event handling and other functionality to applications. Using unmanaged JavaScript creates some limitations and the .NET model discussed in Chapter 8 and the DLR discussed in Chapter 11 are typically better models to use. However, you can still create very robust Silverlight applications using unmanaged JavaScript.
In fact unmanaged Javascript may be a much better choice in some situations. For example, if you would like to add a splash screen to your Web page using Silverlight, then unmanaged JavaScript is the best programming model.
This chapter helps you understand how to use unmanaged JavaScript to programmatically control the design and flow of your Silverlight applications. The following sections introduce the JavaScript relationship to Silverlight and discuss how to use JavaScript to dynamically access and manipulate the content in a Silverlight application.
Understanding the Silverlight-JavaScript Relationship
Unmanaged JavaScript Silverlight applications contain at least three types of code: HTML, XAML, and JavaScript. JavaScript can play two main roles in Silverlight applications. The first role is to create the Silverlight object in the Web page. The second role is to provide a means of programmatically working with the Silverlight plug-in to provide a rich interactive environment.
Managed JavaScript versus unmanaged JavaScript ...
Get Silverlight™ 2 Bible 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.