Silvelight can be integrated with SharePoint sites to provide richness and improve the user experience of the SharePoint sites. There are many ways to integrate the silverlight application (xap) with SharePoint sites. The first option is to leverage the content editor web part and render the silverlight application (xap) through html and JavaScript. This is the simplest way to integrate silverlight applications with SharePoint sites. The other option is to to create a custom web part that does the rendering of the silverlight application.
In this blog post, I’d be sharing the steps to render silverlight applications by leveraging the content editor web part.
Step1
Go the virtual directory in IIS, corresponding to the SharePoint web application. In my case it is C:inetpubwwwrootwssVirtualDirectories1111
Create a sub-folder by name silverlight_bin under the C:inetpubwwwrootwssVirtualDirectories1111
Copy the silverlight application (xap) from the bindebug directory of silverlight project to the sub-folder silverlight_bin
Step2
Add the content editor web part to the page
Step3
Click ‘Modify shared web part’ and enter the following html snippet to the web part to the source editor of the content editor web part
<object data=”data:application/x‐silverlight,” type=”application/x‐silverlight‐2‐b2” width=”400” height=”300”> <param name=”source” value=”/Silverlight_Bin/yoursilverlightapp.xap”/> </object>
Sometimes specifying the object tag in content editor web part may not work properly. If it does not work properly, we need create the object tags and other attributes using javascript.
Pingback: Leverage content editor web part to render silverlight application - My experiments with SharePoint, Azure and .NET using Visual Studio