Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ColumnBase.HeaderPresenterType Attached Property

Gets a value that specifies which grid element contains the column’s header.

Namespace: DevExpress.Xpf.Grid

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

NuGet Package: DevExpress.Wpf.Grid.Core

#Declaration

#Returns

Type Description
HeaderPresenterType

A HeaderPresenterType enumeration value that specifies which grid element contains the column’s header.

#Remarks

The following example applies different settings to column headers based on their location:

HeaderPresenterType

View Example: Customize Column Headers Based on Their Location

<Style TargetType="dxg:GridColumn">
    <Setter Property="HeaderTemplate">
        <Setter.Value>
            <DataTemplate>
                <TextBlock>
                    <TextBlock.Text>
                        <MultiBinding Converter="{local:CustomHeaderConverter}">
                            <Binding />
                            <Binding Path="(dxg:ColumnBase.HeaderPresenterType)" 
                                     RelativeSource="{RelativeSource Self}"/>
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
            </DataTemplate>
        </Setter.Value>
    </Setter>
</Style>
private string GetCustomHeaderString(string originalHeader, HeaderPresenterType headerType) {
    switch (headerType) {
        case HeaderPresenterType.Headers:
            return originalHeader.Replace("Original ", "Custom\nPanel\n");
        case HeaderPresenterType.GroupPanel:
            return originalHeader.Replace("Original", "Custom Group");
        case HeaderPresenterType.ColumnChooser:
            return originalHeader.Replace("Original", "Custom Column Chooser");
    }
    return originalHeader;
}

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

See Also