DataGrid support in Blend 3

Blend 3 adds really cool support for the DataGrid controlĀ (for both Silverlight 3 and WPF Toolkit). Here is a quick demo to help you get started. Enjoy!

  • Create a new Silverlight 3 application
  • Search and instantiate the DataGrid control from the asset library. (As a side, this also demonstrates the newly added support for having custom controls in the Blend asset library - instantiating a custom control adds the necessary assembly references to the project, in this case System.Windows.Controls.Data.dll for Silverlight)

  • Create a data source that has a collection, with one or more properties. (You can easily do this using the new sample data features in Blend).

  • Drag and drop the collection onto the DataGrid - its that simple! Blend will automatically generate the right kind of columns for the various properties in the collection. (TIP: You can select indiviual properties using Shift+Select if you did not want a column for each property in the collection. You can even add the columns individually by dragging and dropping each property onto the DataGrid. Your can right click on the DataGrid to add new columns if you wanted to go that route.)

  • Select a DataGrid column (the one that corresponds to the Image column), right click on the column, and edit the CellTemplate. You can now edit this template just like you would any other template. (TIP: The properties of the DataGrid columns are also available for manipulation via the property grid).