SharePoint Generic Wrapper for Silverlight with initParams

Here is a freebie…just finished a generic SharePoint web-part to host Silverlight apps inside SharePoint.

There are other  out there for sure but I had a need for a generic one that I could specify any number of initParams from the web-part properties in addition to ones I developed that contained separate wp properties for each name/value pair. 

Using just a single wp property for the initParams allows you handle any number of parameters from any of your Silverlight apps using the same web-part-just set both the XAP source location and InitParams for the appropriate Silverlight application.  nbd but it is easier to deploy just a xap file for every new Silverlight application than having to prop a new web part every time:)

 

SLViewer SLViewerWP

 

Web Part Features:

Has a few properties for Silverlight you can set in the web-part properties pane:

Height: sets the SL plugin height (int)

Width: sets the SL plugin width (int)

XAP file location: sets the SL plugin xap file location (string)

Silverlight plug-in id: sets the SL plugin id (string-appended in the web-part code with a GUID to be safe)

InitParams: sets the InitParams for the plugin as one complete name/value pair string (same string you parse on the Silverlight application side as normal)

 

Deployment Instructions:

  1. Download: http://cid-11725deb07615960.skydrive.live.com/self.aspx/Silverlight%20Generic%20Web%20Part/Silverlight2ViewerWebPart.wsp
  2. from command line: stsadm -o addsolution -filename [path on your server where you downloaded file]\Silverlight2ViewerWebPart.wsp
  3. From Central Admin go to operations-solutions management-deploy solution
  4. Download webpart file (.dwp)  http://cid-11725deb07615960.skydrive.live.com/self.aspx/Silverlight%20Generic%20Web%20Part/SilverlightViewer%7C_Web%7C_Part.zip
  5. Go to site settings, web parts, and upload silverlightviewer_web_part.dwp file into web part gallery
  6. (Optional) Download blank Silverlight Application (.xap) http://cid-11725deb07615960.skydrive.live.com/self.aspx/Silverlight%20Generic%20Web%20Part/BlankSilverlightApp.zip
  7. Drop the blanksilverlightapp.xap in a document library or in your SharePoint virtual directory somewhere handy or just use your own xap file and reset the xap file location property of the webpart from the site page. 

System Requirements:

  1. SharePoint 2007 up and running on the server.
  2. Silverlight 2 dll installed in GAC.
  3. MIME types all set in IIS for both .xap and XAML files
  4. Web.config updated with all the Silverlight and AJAX sections. 

Try this link for details on hosting Silverlight on SharePoint (nice post by Karine Bosche)

Coming Soon: I am packaging everything up as a single site feature and maybe even a feature stapler.

have fun:) 

-Rod

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s