wpf-devexpress-dot-xpf-dot-grid-dot-columnbase-55892bf5.md
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
See GetHeaderPresenterType(DependencyObject) and SetHeaderPresenterType(DependencyObject, HeaderPresenterType).
| Type | Description |
|---|---|
| HeaderPresenterType |
A HeaderPresenterType enumeration value that specifies which grid element contains the column’s header.
|
The following example applies different settings to column headers based on their location:
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;
}
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