Skip to main content

BaseColumn.HeaderTemplate Property

Gets or sets the template that defines the column header’s presentation. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v24.1.Core.dll

NuGet Package: DevExpress.Wpf.Grid.Core


public DataTemplate HeaderTemplate { get; set; }

Property Value

Type Description

A DataTemplate object that defines the column header’s presentation.


Specify the HeaderTemplate property to customize header content for an individual column. You can use the DataViewBase.ColumnHeaderTemplate property to specify a common template applied to all columns in the GridControl. The data context (binding source) for these templates is the BaseColumn.HeaderCaption property.

The following code sample demonstrates how to change header content:


<dxg:GridColumn FieldName="CategoryName">
            <TextBlock Text="{Binding}"/>
            <Button Content="Button" Margin="0,5,0,0"/>

View Example: Display an Image within a Column Header

If you have more than one template that defines header content, specify the BaseColumn.HeaderTemplateSelector property to choose a template based on custom logic. Use the BaseColumn.ActualHeaderTemplateSelector property to obtain the actual template selector.

Customize Header Content Based on Location

The GridControl displays column headers in the following containers:

The GridControl applies the HeaderTemplate to column headers in all containers.

For the Column Header Panel, Group Panel, and Column Chooser, you can use the ColumnBase.HeaderPresenterType attached property to determine the header location as demonstrated in the example below:

View Example: Customize Column Headers Based on Their Location

The ColumnBase.FilterEditorHeaderTemplate property allows you to specify a template for headers displayed in the Filter Editor and Filter Panel:


<dxg:GridColumn FieldName="ProductName">
            <TextBlock Text="{Binding}" 
            <TextBlock Text="{Binding}" 

Refer to the following help topic for more information: Header Content Customization.

See Also