Dynamically host Silverlight in SharePoint
SharePoint and Silverlight when combined together provide a powerful platform for building Rich Internet Applications. The below article shows how to host Silverlight control dynamically in SharePoint 2007. This can be done in 3 different ways.
Method 1:
WebPart: CS.WebParts.LoadSL
I was thinking, it sure would be nice to have something like ‘A Dynamic Silverlight loader web part with no configuration of anything (except for the Silverlight MIME types)’. The result – the LoadSL web part for SharePoint 2007.
The LoadSL web part for SharePoint allows you to add Silverlight to SharePoint, and all you need is the path to the XAP file, hight, width, and init params (if any).
All JavaScript and supporting files included as resources embedded in the assembly, so there is no configuration on the part of the user or admin. Just enter the properties, and Silverlight works in SharePoint.
Method 2:
WebPart: CS.WebParts.SLControlHost
In this method, the Silverlight application will be hosted in a ‘div’ element. This ‘div’ element is typically created in the CreateChildControls method of the web part.
No Configuration needed as like Method 1 above.
Method 3:
WebPart: CS.WebParts.XAPLoader
In this method, we are adding a ScriptManager and a Silverlight controls to our class. The only things we have to take care of are to ensure that there is only one instance of a ScriptManager in our current page (we do that with the call ScriptManager.GetCurrent(this.Page);)
Configuration needed for the Web.Config file of the Web application.
Check any of the links to configure the Sharepoint website to host silverlight application.
Configuration Link – 1
Configuration Link – 2
And that’s all, see how simple is now to host silverlight applications in our sharepoint server using any of the above 3 methods.