Silverlight Learning Guide: Working with JavaScript

This section of the Silverlight Learning Guide covers the basics of working with JavaScript, a key programming language for Silverlight development.


   Silverlight Quick Start
   Silverlight: Get the software you need
   Silverlight articles and blogs
   Silverlight 1.0 Release Candidate Tutorials
   Silverlight 1.1 Alpha Tutorials
   Silverlight and JavaScript Tutorials
   More References and Documentation
   Silverlight Samples and Case Studies
   Silverlight Forums and Community

Silverlight and JavaScript Tutorials

JavaScript is the lone programming language supported in Silverlight v1.0 -- remember, the .NET Framework comes with v1.1. Therefore, programming JavaScript is a fundamental skill for Silverlight application development. Here we link to a nine-part tutorial, plus a blog entry from Silverlight guru Scott Guthrie, which should ease some of the JavaScript pain that .NET developers feel. After perusing this tips, check out the next section of the Silverlight Learning Guide, which offers a final set of reference materials.

Tutorial: Silverlight with JavaScript: A sonnet in nine parts (Dave Campbell)
Dave Campbell has penned a nine-part series on Silverlight programming using JavaScript. He was inspired to write such a series because, he said, "I realized that there really still are a lot of developers out there [who] have not actually tried their hand at Silverlight yet because of the perceived complexity involved."

Part 1: An introduction to Silverlight
Here Campbell introduces developers to the three things they need to use Silverlight to enhance an existing Web application -- the existing HTML file, a XAML file for specifying the canvas and the Silverlight.js file that comes with the Silverlight 1.0 RC Software Development Kit (SDK).

Part 2: Silverlight controls
This entry looks into creating Silverlight controls within a Web page. The author has opted to use "createObjectEx()" instead of "createObject()", as the former offers more parameters

Part 3: Silverlight and XAML
This installment offers a look at the XAML file, the object hierarchy of the canvas that the XAML defines, and how XAML objects are related to JavaScript events.

Part 4: Silverlight objects
Here the author gives his objects a name, adds some functionality and points out an annoyance with the object hierarchy that you wouldn't notice just be looking at the code.

Part 5: The Silverlight canvas
In this installment, Campbell offers some insight into the use of the Canvas, which is a placeholder for two or more objects united around the same mouse event, TextBox or whatnot. This involves some new JavaScript code, but it should not be unfamiliar code.

Part 6: Silverlight animation
Animation is a big Silverlight selling point. This part looks at non-interactive animations, exploring the triggers that get an animation going, the parameters that define the triggers controlling an animation and the best ways to work with a "double animation."

Part 7: Silverlight animation redux
To make an animation start of stop "without having to resort to [the] subterfuge" of timing out or hiding an object, just go into the JavaScript and make sure the page contains a global parameter and a ClickMe event.

Part 8: Silverlight gradients
Here Campbell looks at linear and radial gradients. Many tools can create them, but Silverlight offers some nice runtime effects, like filling a gradient as a page runs, and can change gradient parameters at runtime.

Part 9: Silverlight Gradients redux The final piece of this Silverlight puzzle demonstrates how to move the origin of a radial gradient with the mouse at runtime. This, as you might expect, involves writing a MouseMove event in JavaScript.

JavaScript IntelliSense in Visual Studio 2008 (Scott Guthrie)
With the release of VS 2008 Beta 2, the new IDE's JavaScript IntelliSense and JavaScript Debugging features can now be applied to Silverlight applications. This short post (well, short for a Scott Guthrie post) shows how to activate this functionality.

*** Go on to the next section of the Silverlight Learning Guide: More References and Documentation

Dig Deeper on Silverlight and Expression application development

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.