Tuesday, October 19, 2010

How to pass values between SharePoint Web Part and Silverlight

Hi all,

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.

SL 
To support the WebPart i will create the support WebControl class call SilverlightPlugin to pass the Values and file ".XAP" parameter.

SL1

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.

SL3 To pass the values to the Class MainPage the String values “param” and “url” have to be “public”.

SL4

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.

SL2 Very easy :P

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.

 

SL6

SL5

Hope you like this article…
Have fun with SharePoint 2010. :)

Marcas Technorati: ,

1 comment:

Unknown said...

Thanks, Good post.
http://sharepoint-2010-world.blogspot.com/2011/02/creating-external-content-types-in-bcs.html