Beginning Development with Silverlight 2

3 minute read

Half way into 2009 and I’m already finding my New Years resolutions tough to keep. I’ve hardly touched typingweb, Symbian looks like a non starter and I would be lucky if I could memorise a grocery list much less half a deck of cards. But the one goal which has been right on track is my “Learn WPF” goal. So much so in fact, that I have decided to “upgrade” the goal and learn Silverlight as well. I haven’t been writing much about the WPF learning process so I thought I’d remedy that by writing about my forays into the world of Silverlight 2.

Some of you might be wondering why I’m using Silverlight 2 and not 3. Simple. I’ve been playing around with Silverlight before version 3 was released. I’ll upgrade to version 3 once a good reference book on it is released.

What is Silverlight?

Silverlight 2 is a cross-browser, cross platform browser platform that implements a subset of the .Net 3.5 framework. It aims to deliver advanced graphics and multimedia to enable Rich Internet Applications, or RIAs, for the web. Because its .Net based, you can develop Silverlight 2 applications in any .Net language including C#, VB and IronPython. The user interface can be developed in Visual Studio 2008 or Expression Blend 2. The user interface is defined using a declarative XML user interface mark-up language called XAML. A more complete version of XAML is used to declare the user interface in WPF applications so the learning curve for Silverlight 2 should be almost flat for developers who understand WPF.

What do you need to develop Silverlight Applications?

I use Visual Studio 2008 as my primary development environment and all that is needed to enable Silverlight development is the Silverlight Tools for Visuals Studio 2008 add-on.

This installs the following:

  1. Silverlight developer runtime
  2. Silverlight SDK
  3. Silverlight Tools

A full list of what you need to get started is on the silverlight.net site. The beauty of it is you can download the free version of Microsoft Visual Studio 2008 or the free Visual Web Developer and get all the tools you need to develop Silverlight applications. This, in my opinion, is what makes developing for the Microsoft platform so much more appealing than say Adobe development. Nokia has taken this further and released their entire Symbian development environment (Carbide) for free.

Examples of Silverlight Applications

There some really cool examples of Silverlight Applications out there. Here are some examples that I’ve come across.

  1. Silverlight games – These are mainly Silverlight 1 games but the cool thing is that most of them have the source code available.
  2. Microsoft’s Tim Sneath also has a list of Silverlight 1 and Silverlight 1.1 Applications
  3. Silverlight.net has a really great gallery Silverlight 1 and Silverlight 2 applications. A lot of these come with source code and you can download and host some of them on your own site.
  4. Scott Hanselman has also been collecting links to Silverlight sample applications.
  5. Shawn Wildermuth has some great links on his site
  6. Laurent Bugnion has a great blog on tips for Silverlight development. Laurent is also the author of the Silverlight 2 Unleashed book that I bought.

Silverlight as a competitor to Adobe Flash

Adobe flash is probably more pervasive on the web at the moment than Silverlight. My reasons for starting in Silverlight rather flash is due to my development background. My language progression has been from C to C++ to Java and then C#. If I had started with JavaScript, I probably would prefer flash as the Actionscript language is very similar. The biggest barrier for me is the cost of the development tools. With Silverlight, you can download Visual Studio 2008 Express Edition and Silverlight SDK for free. I have not been able to find a free version of the flash development tools.