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:)
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:
- Download: http://cid-11725deb07615960.skydrive.live.com/self.aspx/Silverlight%20Generic%20Web%20Part/Silverlight2ViewerWebPart.wsp
- from command line: stsadm -o addsolution -filename [path on your server where you downloaded file]\Silverlight2ViewerWebPart.wsp
- From Central Admin go to operations-solutions management-deploy solution
- Download webpart file (.dwp) http://cid-11725deb07615960.skydrive.live.com/self.aspx/Silverlight%20Generic%20Web%20Part/SilverlightViewer%7C_Web%7C_Part.zip
- Go to site settings, web parts, and upload silverlightviewer_web_part.dwp file into web part gallery
- (Optional) Download blank Silverlight Application (.xap) http://cid-11725deb07615960.skydrive.live.com/self.aspx/Silverlight%20Generic%20Web%20Part/BlankSilverlightApp.zip
- 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:
- SharePoint 2007 up and running on the server.
- Silverlight 2 dll installed in GAC.
- MIME types all set in IIS for both .xap and XAML files
- 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
Posted on May 14, 2009, in Sharepoint, Silverlight. Bookmark the permalink. Leave a Comment.


Leave a Comment
Comments (0)