Back to Devexpress

ColumnBase.HeaderPresenterType Attached Property

wpf-devexpress-dot-xpf-dot-grid-dot-columnbase-55892bf5.md

latest3.7 KB
Original Source

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.v25.2.Core.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

See GetHeaderPresenterType(DependencyObject) and SetHeaderPresenterType(DependencyObject, HeaderPresenterType).

Returns

TypeDescription
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:

View Example: Customize Column Headers Based on Their Location

xaml
<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>
csharp
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;
}
vb
Private Function GetCustomHeaderString(ByVal originalHeader As String, ByVal headerType As HeaderPresenterType) As String
    Select Case headerType
        Case HeaderPresenterType.Headers
            Return originalHeader.Replace("Original ", "Custom" & Microsoft.VisualBasic.Constants.vbLf & "Panel" & Microsoft.VisualBasic.Constants.vbLf)
        Case HeaderPresenterType.GroupPanel
            Return originalHeader.Replace("Original", "Custom Group")
        Case HeaderPresenterType.ColumnChooser
            Return originalHeader.Replace("Original", "Custom Column Chooser")
    End Select

    Return originalHeader
End Function

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

See Also

Header

ColumnBase Class

ColumnBase Members

DevExpress.Xpf.Grid Namespace