ColumnHeaderStyle Property
Collapse the table of content
Expand the table of content

DataGrid.ColumnHeaderStyle Property


Gets or sets the style applied to all column headers in the DataGrid.

Namespace:   System.Windows.Controls
Assembly:  PresentationFramework (in PresentationFramework.dll)

public Style ColumnHeaderStyle { get; set; }

Property Value

Type: System.Windows.Style

The style applied to all column headers in the DataGrid. The registered default is null. For more information about what can influence the value, see DependencyProperty.

Apply a Style to update the visual appearance of all the column headers in the DataGrid. To define a Style for a column header, specify a TargetType of DataGridColumnHeader.

A Style can be applied to all column headers, or to an individual column header. To apply a Style to an individual header, set the DataGridColumn.HeaderStyle property, which takes precedence over the DataGrid.ColumnHeaderStyle property.

Legacy Code Example

The following example uses a style resource to change the style of column headers in the DataGrid. The style of the first column header is then set with an inline style that overrides the DataGrid.ColumnHeaderStyle.

Code snippet is not found. Confirm that the code snippet name 'DataGrid_ColumnHeaderStyle' is correct.

The following illustration shows the output.

Styled DataGrid Column Headers

.NET Framework
Available since 4.0
Available since 2.0
Return to top
© 2015 Microsoft