Skip to main content
All docs
V25.1
  • DxTreeListSelectionColumn.HeaderTemplate Property

    Specifies a template for the selection column header.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    [Parameter]
    public RenderFragment<TreeListSelectionColumnHeaderTemplateContext> HeaderTemplate { get; set; }

    Property Value

    Type Description
    RenderFragment<TreeListSelectionColumnHeaderTemplateContext>

    The selection column’s header template.

    Remarks

    A selection column allows users to select and deselect rows. When the SelectionMode property is set to TreeListSelectionMode.Multiple (the default value), the selection column displays checkboxes. A user can click the checkbox in the header cell to select or deselect all rows on the current page.

    You can define the HeaderTemplate to display custom content in the selection column header. Use the template’s context parameter to access the SelectionColumn and TreeList objects. The parameter’s Selected property specifies whether rows on the current page are selected.

    The following code snippet displays the custom Select All button in the selection column header:

    @inject EmployeeTaskService EmployeeTaskService
    
    <DxTreeList @ref="MyTreeList"
                Data="TreeListData"
                KeyFieldName="Id"
                ParentKeyFieldName="ParentId"
                @bind-SelectedDataItems="@SelectedDataItems">
        <Columns>
            <DxTreeListSelectionColumn>
                <HeaderTemplate>
                    <DxButton Click="() => MyTreeList.SelectAllOnPage()" Text="Select All"
                              RenderStyle="ButtonRenderStyle.Link" />
                </HeaderTemplate>
            </DxTreeListSelectionColumn>
            <DxTreeListDataColumn FieldName="Name" Caption="Task" />
            <DxTreeListDataColumn FieldName="EmployeeName" />
            <DxTreeListDataColumn FieldName="StartDate" />
            <DxTreeListDataColumn FieldName="DueDate" />
        </Columns>
    </DxTreeList>
    
    @code {
        List<EmployeeTask> TreeListData { get; set; }
        IReadOnlyList<object> SelectedDataItems { get; set; }
        ITreeList MyTreeList { get; set; }
    
        protected override void OnInitialized() {
            TreeListData = EmployeeTaskService.GenerateData();
        }
    }
    

    Blazor TreeList Selection Column Header Template

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

    Implements

    See Also