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

Looking for some SharePoint tips/tricks? Some cool stuff on the SharePoint GetThePoint Blog

A few cool finds (especially getting past the SharePoint blog HTML editor removing all your embed code!)

Embed video in your SharePoint blogs and wikis – Friday Cool Content

Access and SharePoint integration for beginners

Building a Solution in SharePoint for the University of Washington

What they say about their blog:
The blog by the Microsoft SharePoint End-User Content Team. The blog is designed, written, and published by the writers who bring you the SharePoint content on Office Online. We write content for all SharePoint Products and Technologies and encourage contributions from the SharePoint user community.

My Own Disclaimer: I admit this is a shameless plug since I post there on occasion as a guest blogger but a nice variety of end-user tips and at least one cool find for getting around the SharePoint blog HTML editor from stripping out your embed tags (a project on CodePlex that looks promising for something short of developing/installing your own)

My posts so far..
SharePoint and Silverlight-Accessing SharePoint list data for Silverlight without web services

Windows Live Writer is Great for SharePoint Blogs Too

-Rod