This article try to explain how we can use SharePoint 2010 Web Part and pass values to Silverlight using code Behind and Visual studio and i will not enter on details on how we create WebPart Solution, that is other article....
The first thing you will need create on your WebPart is the embeeded Object for the Silverlight.
On the embeeded Object we need to define the following Parameters:
- Source: The XAP file where will be our Silverlight Solution.
- initparams: The values will pass from the webpart to our Silverlight solution.
To pass the values from the WebPart to Silverhligth we need to call the App.xaml file to access to Method “Application_Startup”. We call the values using InitParams and this values will pass to the MainPage Class like described in the image.
This values can be very usefull if you want to pass info and pre-load info from the current Site, will help users add the correct information.
By default already exist “Silverlight web Part” and have a property to pass values from Web Part to Silverlight, this is a example on how the values are transfer between this 2 diferent products.
Hope you like this article…
Have fun with SharePoint 2010. :)