Back to TreeGrid home

Dynamic Microsoft SilverLight objects in cells

This example works only in browsers with installed Microsoft SilverLight 1.0+ plugin. The plugin can be downloaded from http://www.microsoft.com/silverlight/. For SilverLight documentation see MSDN.

This example uses windowless mode that does not work in some browsers (Google, Safari) and some plugin versions, in this case you can try windowed version.

This example demonstrates how to display any SilverLight object inside TreeGrid cells.
Also demonstrates dynamical creating / updating the SilverLight objects according to some condition, for example value in other cell.
And finally demonstrates displaying HTML content and SilverLight object within one cell.

This example uses SilverLightEmptyObject.xaml file as base source for all SilverLight objects in grid. The TreeGrid xml source is defined in SilverLight.xml.
The main work is done by JavaScript funtion Draw included in this HTML page. This function is called from various events to (re) draw the SilverLight object. There is no external script file needed for this example.

In the Number column are custom numbers. In the SilverLight column is drawn an ellipse by SilverLight plugin and text value as standard HTML text. The width of the ellipse and the HTML text is related to Number column value.
You can edit Number column values, sort rows, filter rows, copy&paste rows, delete rows, add new rows and drag rows by mouse. You can see that the SilverLight column values are always updated.