How to bind the VIBlend Silverlight Data Grid to indexed properties?
|
Article Information
|
This article relates to the VIBlend DataGrid for Silverlight. It contains a complete example which illustrates how to create a custom data source and then bind the DataGrid control to it.
|
How To
|
Bind the DataGrid to indexed properties
|
Solution
|
To achieve this, follow these steps:
|
1. Create DataTemplates that are bound to indexed properties.
|
|
2. Create a new DataGrid instance. Set the CellDataTemplate property of the DataGrid’s BoundFields to point to the DataTemplates.
|
|
3. Create a new class that will represent a single record of the DataGrid.
|
|
4. Create a new generic List of Person objects and set the ItemsSource property of the DataGrid, in order to bind it to the list.
|
|
|