TechEd 2008 - Silverlight 2 for Developers
September 3rd 2008Earlier today I gave my “Silverlight 2 for Developers” talk at TechEd New Zealand. I know the title is a little bit vague, but the session was generally trying to give developers who want to build “real applications” a good starting point. It’s a level 300 talk (advanced), so it skips the basic introduction. That being said you don’t need to be a Silverlight expert to find the session useful. The talk covered things like CRUD applications using WCF, how to implement a Presentation Model/ViewModel, how to use IoC and DI in Silverlight, and how to do unit testing in Silverlight.
The theme of the talk was diving, and for the demos I worked on a dive log application. The application is fairly complete, and I’ve made it available online for anyone to play with. The code should also be a good sample application for anyone who wants to get into building data centric Silverlight applications. I’m planning on building on the dive log sample in future blog posts, and already have several ideas in the pipeline.
You can run the application by clicking the screenshot. You will be asked to login, and any username and password will be valid. If the user doesn’t exist it will be created when you login. You can even run the unit tests directly from your browser if you want.
Slides
I’ve uploaded the slides to Slide Share, or you can download the full presentation from my Sky Drive.
Links and resources
Unit Testing in Silverlight
- Unit Testing with Silverlight 2 by Jeff Wilcox
Jeff is the primary developer on the Silverlight testing framework, and this is probably the best introduction to Silverlight Unit Testing. - Unit testing templates for Microsoft Silverlight 2 Beta 2
To make things easier Jeff has prepared a Visual Studio template to set up Silverlight Unit Testing. - What’s in the pipeline for Silverlight Test Developers
Jeff hints about what might come in the next version of the Silverlight testing framework. - Unit Testing Asynchronous Code in Silverlight
This is a post I did back in June describing how to use the Asynchronous attribute, and how to write asynchronous tests in Silverlight. - Silverlight NUnit Projects
Jamie Cansdale explains how to use NUnit to do Silverlight testing. The benefit of using NUnit is that you can run your tests outside the browser, execute the tests from TestDriven.Net, and even get code coverage. For integration testing (network, browser integration) you still need to use the Silverlight Testing Framework from Microsoft. - White – Windows Application Automation
Open source framework to automate and test Win32, Windows Forms, WPF and Java. Since Silverlight supports the same UI Automation API as WPF you should be able to use this framework to test Silverlight applications as well.
Presentation Model / View Model
- ViewModel Pattern in Silverlight using Behaviors
Nikhil Kothari introduces the ViewModel pattern in a Silverlight context. He also shows how to add declarative behaviors to Silverlight controls to get decoupled events. - ViewModel Pattern extended with the Dynamic Language Runtime
In this post Nikhil extends his ViewModel example and use the dynamic language runtime to get an even more elegant way of adding behaviors to Silverlight controls. - Presentation Model
Fowlers essay describing the Presentation Model pattern. In essence this is the same pattern as the Model-View-ViewModel pattern, but not in a Silverlight/WPF specific context. - YouCard Re-visited: Implementing the ViewModel pattern
In this post I describe how I refactored the YouCard application to use the ViewModel pattern. - PIXEL8 Pod Cast – John Gossman Architects WPF
In this post cast John discusses the value of the Model-View-ViewModel design pattern, one of the patterns used when designing Expression Blend.
Dependency Injection
- Ninject: Lightning-fast dependency injection for .NET
One of the cool things about Ninject is the great landing page for the project. It gives you easy access to download links, tutorials, the coding dojo and the discussion board. It’s a really easy framework to get started with. - List of .NET Dependency Injection Containers (IoC)
Scott Hanselman has assembled a list of .NET IoC containers, and gives a brief description of each of them. - YouCard Re-visited: Implementing Dependency Injection in Silverlight
In this post I describe how I added dependency injection to the YouCard application using Ninject.

