Silverlight 2.0 Hello World

by Miguel de Icaza

Silverlight's 2.0 deployment model changed significantly from the 1.1 alpha model. In the past you would load a XAML file, and then on demand load any managed libraries referenced from the XAML file before parsing could continue.

With Silverlight 2.0 the model has changed. One of the downsides is that now you deploy things as a ZIP file with a manifest file which feels obnoxious. On the upside, the loop "try-to-parse-or-keep-requesting-files-from-the-browser-until-all-dependencies-are-downloaded" is now gone. Now you get a zip file asynchronously, unpack it, load all the assemblies in the zip file, create an instance of the class specified as the entry point, and off you go. No more latency.

This hopefully also solves an obnoxious pattern that was common in 1.1: calling createFromXaml from Javascript could hang execution while Moonlight waited for the browser to fetch a missing assembly.

This week Silverlight 2.0 said hello in Linux:

This corresponds to the standard template with the content of the user control set to a TextBlock.

There are some peculiar patterns in Silverlight 2.0 instantiation model. Instead of creating objects from a XAML description, an object of a known-type is first created, and then the object is initialized from a XAML file. Your object is supposed to call LoadComponent ("my-xaml-definition") to initialize itself.

Posted on 18 May 2008