Skip to main content

DataViewBase.ColumnHeaderTemplate Property

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

Namespace: DevExpress.Xpf.Grid

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

NuGet Package: DevExpress.Wpf.Grid.Core

Declaration

public DataTemplate ColumnHeaderTemplate { get; set; }

Property Value

Type Description
DataTemplate

A DataTemplate object that defines the presentation of column header contents.

Remarks

Specify the BaseColumn.HeaderTemplate property to customize header content for an individual column. You can use the 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:

ColumnHeaderCustomizationHeaderTemplate

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

View Example: Display an Image within a Column Header

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

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

See Also