First Silverlight 1.1 App

After all the MIX announcements and releases I started playing with the Silverlight 1.1 Alpha. For my first app I was inspired by the MS Chess demo to make a TicTacToe game. I decided not to make a computer player since the point was really just to work with Silverlight. After working on full WPF going to the 1.1 Alpha sort of feels like going from Visual Studio to NotePad. There are very few controls at this point and even the classes that are available are often missing methods and properties. Brushes, for example, doesn’t exist yet and Colors only has a few basic named colors (hence the crazy color palette in my first app). Having said that, the stuff that is there really is a good foundation to start on and seems to be working great. Even though this stuff is only Alpha I haven’t had the tools or the browser plugin crash yet. 

I’m still working on setting up stable hosting for my first app so I can embed it here but at this point it’s just running on my dev box. There are instructions in the SDK docs for setting up IIS to host Silverlight which are also posted here. For now here are some screenshots: 

TicTacToe1 TicTacToe2 

If you just want to run a Silverlight app locally you don’t need any IIS configuration. Running from file://… pointed at the html file works just the same but without any extra configuration. The code for my app is here. To run it you need to have Silverlight 1.1 Alpha installed. Extract the folder somewhere, open up TestPage.html and it should start right up (I can’t be held accountable if it doesn’t – it’s only Alpha!). To actually edit the project you will additionally need Orcas Beta 1 and the Silverlight Tools Alpha for Orcas Beta 1. It can also be opened in Blend 2 May Preview. Download links for everything are at http://silverlight.net/GetStarted/

So what’s actually going on when you open up TestPage.html? I’m still digging into the mechanics of it but basically there’s a div tag in the html page which is populated by Javascript. In Javascript a Silverlight object is created by referencing the Page.xaml file. Page.xaml in turn points at the dll compiled from the .cs code behind. Once all this stuff gets to the browser, the Silverlight CLR has everything it needs to start running just like a normal .NET app and off you go.

Leave a Reply

Your email address will not be published. Required fields are marked *