Silverlight Isn't Just about Presentation...

continuum2 I wanted to highlight a Silverlight feature that is often overlooked, relating to the way that Silverlight interacts with HTML. Although most people think about Silverlight as a technology for building web-based user interfaces through XAML, it also offers some attractive benefits to developers who want to work exclusively with HTML.

I've started to make use of the figure on the right when I deliver presentations on Silverlight, to highlight the range of choices available with the runtime. The top left corner of course represents the state of web development today: HTML used for presentation markup, with JavaScript providing the "glue" on the client-side that enables interactivity and AJAX-style functionality.

Silverlight 1.0 can be summed up fairly succinctly as supplying the box in the bottom left hand corner: using the same JavaScript logic, but instead using XAML as the markup. This works really well for embedded content, since the exact same JavaScript function can target both HTML and XAML content without any artificial boundaries getting in the way.

Silverlight 1.1 (currently in alpha) takes the same XAML model and adds a refactored version of the .NET Framework that contains just what's needed for web client development in a vastly smaller package size (represented by the bottom right corner). The difference with 1.0 is less about what you can do and more about the efficiency of doing it - having access to C#, LINQ, XML parsers, custom controls, and so on is a huge productivity boon and it enables you to build cross-platform rich internet applications that use the .NET skills you already have.

The final combination (top right) is HTML / .NET, and this is the one that's least understood by developers I speak to. Here, it's possible to embed the Silverlight runtime in a page without using it to display any visual content. In this context, Silverlight is a way to use VB, C# or indeed a dynamic language like Python to interact with HTML - both having HTML call .NET code and in having .NET code manipulate the HTML DOM (e.g. adding new elements to the tree).

In the next blog post, I'll show you exactly how you can go about do this; in the meantime, for more information I can highly recommend Stefan Shackow's session from MIX, which talks about this in great length.