Freigeben über


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).

Comments

  • Anonymous
    March 19, 2009
    Thank you for submitting this cool story - Trackback from DotNetShoutout

  • Anonymous
    January 12, 2010
    Hi! Can u show how works DataGridComboBoxColumn with Blend SampleData

  • Anonymous
    August 20, 2011
    Can you provide an example of the data binding you are referring to www.dapfor.com