Silverlight 2 is here and with it's arrival there are going to be a whole load of Blogengine.NET using developers wanting to embed their sample Silverlight apps in their blog posts.
Presented here is a Blogengine.NET extension which makes all the necessary arrangements to embed your content. It works, like most others, by using a token that you type into your posts and in the most basic form looks like this:
[ silverlight:source=/ClientBin/MySilverlightApp.xap ] (without the spaces!)
All very self explanatory... Simply enough, the extension adds the silverlight.js (the latest from the Silverlight 2 Beta 1) file to the head section of the page and then calls Silverlight.createObjectEx for each instance of the plugin on the page.
Using the extension manager you can set all of the other options that this function call takes.

As you can see from the help text though, all these values are just defaults which will be used if they are not specified with the token. The format looks as follows.
[ silverlight:source=/ClientBin/MySilverlightApp.xap;width=640;height=480 ] (without the spaces!)
The format is "key=value" and each pair seperated by ";". Any of the settings in the Extension Manager can be overriden like this, although width and height are the most commonly needed ones, the only required parameter is "source". Here is a sample from my previous post.
Included in the download below is two things. SilverlightExtension.cs needs to be upoaded to your /App_Code/Extensions folder. There is also a folder in the zip file with one file in, script/SilverlightExtension.js. This needs to be put into the root of your website, with the final layout looking like this:
/App_Code/Extensions/SilverlightExtension.cs
/script/SilverlightExtension.js
Hope this comes in handy, enjoy!
SilverlightExtension.zip (5.25 kb)