Blogengine.NET extension for embedding a Silverlight plugin

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)

kick it on DotNetKicks.com  

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList
March 7, 2008 22:19 by Sean
E-mail | Permalink | Comments (6) | Comment RSSRSS comment feed

Related posts

Comments

March 26. 2008 17:35

I have to research a little more to start using Silverlight.
We'll see.

Alejandro

March 27. 2008 15:00

using Silverlight

flko

March 29. 2008 06:22

good site

Megaupload links

March 29. 2008 14:15

Good site!!! Enhorabuena y gracias.

www.lesnoticias.com

LesNoticias.com

March 29. 2008 15:32

I wonder if Silverlight is better or the same thing like Flash. Somebody knows?

Rómulo

March 29. 2008 18:52

I'm using silverlight in one of my projects and is wonderful.
This extension is nice.

Good blog ;)

Online games

Comments are closed