O'Reilly logo

Silverlight 4 Data and Services Cookbook by Kevin Dockx, Gill Cleeren

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using custom columns in the DataGrid

By default, the DataGrid will generate columns for us based on the type of objects that we pass to the control. We looked at this in the Displaying the data in a customized DataGrid recipe. However, we'll want more control over what is being displayed most of the time. We'll want to make decisions such as which columns should be shown, in what order and so on. On top of that, we may want to allow the user to select a value from a ComboBox for a particular column or entirely reformat a value.

In this recipe, we'll take full control over what will be displayed by the DataGrid by creating a number of columns ourselves.

Getting ready

To follow along with this recipe, you can continue using the code that was created ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required