Skip to main content
All docs
V24.1

DxTreeList.ColumnHeaderCaptionTemplate Property

Specifies a common template used to display captions of all column headers in the TreeList.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public RenderFragment<TreeListColumnHeaderCaptionTemplateContext> ColumnHeaderCaptionTemplate { get; set; }

Property Value

Type Description
RenderFragment<TreeListColumnHeaderCaptionTemplateContext>

Template content.

Remarks

The ColumnHeaderCaptionTemplate allows you to customize captions of all column headers in the TreeList. To define a template for individual column headers, use the DxTreeListColumn.HeaderCaptionTemplate.

The ColumnHeaderCaptionTemplate accepts a TreeListColumnHeaderCaptionTemplateContext object as the context parameter. You can use parameter 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 shows a tooltip when a user hovers the mouse pointer over any column caption:

@inject EmployeeTaskService EmployeeTaskService

<DxTreeList Data="TreeListData" KeyFieldName="Id" ParentKeyFieldName="ParentId">
    <Columns>
        <DxTreeListDataColumn FieldName="Name" Caption="Task" />
        <DxTreeListDataColumn FieldName="EmployeeName" />
        <DxTreeListDataColumn FieldName="StartDate" />
        <DxTreeListDataColumn FieldName="DueDate" />
    </Columns>
    <ColumnHeaderCaptionTemplate>
        <span title="Click the header to sort data by this column. Drag and drop the header to change the column's position">
            @context.Caption
        </span>
    </ColumnHeaderCaptionTemplate>
</DxTreeList>

@code {
    List<EmployeeTask> TreeListData { get; set; }

    protected override void OnInitialized() {
        TreeListData = EmployeeTaskService.GenerateData();
    }
}

Blazor TreeList Column Header Caption Template

For more information about templates in the TreeList component, refer to the following topic: Templates in Blazor TreeList.

See Also