colinramsay.co.uk

The Simplest Silverlight Example

01 May 2007

I've been doing some research on the recently announced Silverlight project, and I wanted to get an ultra-simple example up and running. It uses inline XAML and the silverlight.js file to present a canvas with a textarea inside, and you can find it here:

Ultra-Simple Silverlight Example

The silverlight.js file was grabbed from the quickstart examples, and is not strictly needed. You could build the HTML to include the plugin yourself, but this file handles that and all the cross-browser stuff which is needed too. Just view the source to see how it works.

There's one very important point to make about this file - there's no doctype declaration. I normally do include this, but doing so will break this approach in Firefox. This only happens when using inline XAML, so it's not a huge issue.