DataGrid
Microsoft Silverlight will reach end of support after October 2021. Learn more.
The DataGrid control provides a flexible way to display a collection of data in rows and columns. The built-in column types include a text column, a check box column, and a template column for hosting custom content. The built-in row type includes a drop-down details section that you can use to display additional content below the cell values.
The DataGrid control supports common table formatting options, such as alternating row backgrounds and the ability to show or hide headers, grid lines, and scroll bars. Additionally, the control provides several style and template properties that you can use to completely change the appearance of the control and its rows, columns, cells, and row or column headers.
The topics in this section describe the additional concepts and techniques that you can use to build DataGrid control features into your applications.
To view a running sample of the DataGrid control, click the following link.
In This Section
Default Keyboard and Mouse Behavior in the DataGrid Control
Describes how users can interact with the DataGrid control by using the keyboard and mouse.How to: Add a DataGrid Control to a Page
Shows how to add a DataGrid control to a page.How to: Display and Configure Row Details in the DataGrid Control
Shows how to use the DataGrid row details section.How to: Customize Auto-Generated Columns in the DataGrid Control
Shows how to handle the AutoGeneratingColumn event for a DataGrid.How to: Group, Sort, and Filter Data in the DataGrid Control
Shows how to group, sort, and filter data using a PagedCollectionView.Walkthrough: Customizing the DataGrid Control Using Properties
Shows how to customize the appearance and behavior of the DataGrid by setting properties.Sizing Options in the DataGrid Control
Describes how to control absolute and automatic sizing in the DataGrid.
Tasks
You can accomplish the following tasks with the example code at the specified location.
Task |
Example location |
---|---|
Using the DataGrid control. |
|
Binding a DataGrid to a data source. |
|
Displaying and configuring row details. |
|
Displaying alternating row background colors. |
|
Using styles with the DataGrid control. |
|
Using the text column type. |
|
Using the check box column type. |
|
Using the template column type. |
Reference