DxTreeListColumn.HeaderCaptionTemplate Property
Specifies a template used to display the column header’s caption.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
Declaration
[Parameter]
public RenderFragment<TreeListColumnHeaderCaptionTemplateContext> HeaderCaptionTemplate { get; set; }
Property Value
Type | Description |
---|---|
RenderFragment<TreeListColumnHeaderCaptionTemplateContext> | The template for the column header’s caption. |
Remarks
The HeaderCaptionTemplate
allows you to customize captions of individual column headers. To define a common template for all header captions in the TreeList, use the DxTreeList.ColumnHeaderCaptionTemplate.
The HeaderCaptionTemplate
accepts a TreeListColumnHeaderCaptionTemplateContext object as the context
parameter. You can use the parameter’s members to get the current Caption, and the Column or DataColumn object. You can also access the TreeList object and use its members to obtain additional information about the TreeList.
The following example displays custom captions for TreeList columns:
@inject SpaceObjectDataProvider SpaceObjectDataProvider
<DxTreeList Data="TreeListData" ChildrenFieldName="Satellites">
<Columns>
<DxTreeListDataColumn FieldName="Name" />
<DxTreeListDataColumn FieldName="TypeOfObject" Caption="Type" />
<DxTreeListDataColumn FieldName="Mass10pow21kg" Caption="Mass, kg" DisplayFormat="N2">
<HeaderCaptionTemplate>Mass, 10<sup>21</sup> × kg</HeaderCaptionTemplate>
</DxTreeListDataColumn>
<DxTreeListDataColumn FieldName="MeanRadiusInKM" Caption="Radius, km" DisplayFormat="N2"/>
<DxTreeListDataColumn FieldName="Volume10pow9KM3" DisplayFormat="N2">
<HeaderCaptionTemplate>Volume, 10<sup>9</sup> × km<sup>3</sup></HeaderCaptionTemplate>
</DxTreeListDataColumn>
<DxTreeListDataColumn FieldName="SurfaceGravity" DisplayFormat="N2">
<HeaderCaptionTemplate>Gravity, m/s<sup>2</sup></HeaderCaptionTemplate>
</DxTreeListDataColumn>
</Columns>
</DxTreeList>
@code {
object TreeListData { get; set; }
protected override async Task OnInitializedAsync() {
TreeListData = SpaceObjectDataProvider.GenerateData();
}
}
For more information about templates in the TreeList component, refer to the following topic: Templates in Blazor TreeList.