Skip to main content

ColumnBase.GetHeaderPresenterType(DependencyObject) Method

Gets the value of the ColumnBase.HeaderPresenterType attached property for a specified DependencyObject.

Namespace: DevExpress.Xpf.Grid

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

NuGet Package: DevExpress.Wpf.Grid.Core


public static HeaderPresenterType GetHeaderPresenterType(
    DependencyObject element


Name Type Description
element DependencyObject

The element from which the property value is read.


Type Description

The ColumnBase.HeaderPresenterType property value for the element.


This example adds the Click button to the Id column’s header when it is displayed in the Column Chooser.

Grid - Custom Content for the Column Chooser Header

    <DataTemplate x:Key="columnChooserTemplate">
        <StackPanel Orientation="Horizontal">
            <TextBlock Text="{Binding}"/>
            <Button Content="Click" Margin="5,0,0,0"/>

    <local:HeaderTemplateSelector x:Key="headerTemplateSelector" 
                                  ColumnChooserTemplate="{StaticResource columnChooserTemplate}"/>

<dxg:GridControl x:Name="grid" AutoGenerateColumns="AddNew">
        <dxg:TableView x:Name="view" ColumnHeaderTemplateSelector="{StaticResource headerTemplateSelector}"/>
public class HeaderTemplateSelector : DataTemplateSelector {
    public DataTemplate ColumnChooserTemplate { get; set; }
    public override DataTemplate SelectTemplate(object item, DependencyObject container) {
        if (ColumnBase.GetHeaderPresenterType(container) == HeaderPresenterType.ColumnChooser && (string)item == nameof(Item.Id))
            return ColumnChooserTemplate;
        return base.SelectTemplate(item, container);

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetHeaderPresenterType(DependencyObject) method.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also