GridView Column Header Styles and Templates Overview

This overview discusses the order of precedence for properties that you use to customize a column header in the GridView view mode of a ListView control.

Customizing a Column Header in a GridView

The properties that define the content, layout, and style of a column header in a GridView are found on many related classes. Some of these properties have functionality that is similar or the same.

The rows in the following table show groups of properties that perform the same function. You can use these properties to customize the column headers in a GridView. The order of precedence for related properties is from right to left where the property in the farthest right column has the highest precedence. For example, if a ContentTemplate is set on the GridViewColumnHeader object and the HeaderTemplateSelector is set on the associated GridViewColumn, the ContentTemplate takes precedence. In this scenario, the HeaderTemplateSelector has no effect.

Related properties for column headers in a GridView

GridView GridViewColumn GridViewColumnHeader
Context Menu Properties ColumnHeaderContextMenu Not applicable ContextMenu
ToolTip

Properties
ColumnHeaderToolTip Not applicable ToolTip
Header Template

Properties
ColumnHeaderTemplate 1/

ColumnHeaderTemplateSelector
HeaderTemplate 1/

HeaderTemplateSelector
ContentTemplate 1/

ContentTemplateSelector
Style Properties ColumnHeaderContainerStyle HeaderContainerStyle Style

1For Header Template Properties, if you set both the template and template selector properties, the template property takes precedence. For example, if you set both the ContentTemplate and ContentTemplateSelector properties, the ContentTemplate property takes precedence.

See also