Add Silverlight application in Sharepoint 2010

Microsoft SharePoint 2010 comes with an out of the box Silverlight webpart which helps to host Silverlight applications in SharePoint. For hosting the Silverlight application you need to provide the URL of the Silverlight executable in the URL property of the webpart.




You can also pass the parameters to the Silverlight application using InitParams property.



You need to implement the Silverlight application such a way that it can accept and use the InitParams, which can be consumed in Application_Start event.


private void Application_Startup(object sender, StartupEventArgs e)
{
IDictionary parameters = e.InitParams;
foreach (KeyValuePair parameter in parameters)
{
Console.WriteLine("{0} - {1}", parameter.Key, parameter.Value);
}
}

Comments