Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TreeListSelectionColumnHeaderTemplateContext.SelectAllEnabled Property

Determines if the Select All operation is available.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
public bool SelectAllEnabled { get; }

#Property Value

Type Description
Boolean

true if the Select All operation is available; otherwise, false.

#Remarks

A selection column contains a checkbox in the header cell if the column’s AllowSelectAll option is enabled. You can define the column’s HeaderTemplate to display custom select elements in the header.

The Select All operation can be temporarily unavailable if you bind the TreeList to the GridDevExtremeDataSource or load data on demand. The SelectAllEnabled context parameter returns false while the Select All operation cannot be performed. Once this operation becomes available, this parameter returns true.

In the template, use the SelectAllEnabled parameter to specify the enabled or disabled state for a custom select element. In the same way, you can use the SelectEnabled parameter in the selection column’s CellDisplayTemplate.

@inject CitiesService CitiesService

<DxTreeList Data="@Data"
            KeyFieldName="ID"
            ParentKeyFieldName="ParentID"
            HasChildrenFieldName="HasChildren"
            @bind-SelectedDataItems="@SelectedDataItems">
    <Columns>
        <DxTreeListSelectionColumn>
            <HeaderTemplate>
                <DxButton Click="() => context.TreeList.SelectAllOnPage()" Text="Select All"
                          RenderStyle="ButtonRenderStyle.Link"
                          Enabled="context.SelectAllEnabled" />
            </HeaderTemplate>
        </DxTreeListSelectionColumn>
        <DxTreeListDataColumn Caption="Location" FieldName="Name" />
        <DxTreeListDataColumn FieldName="CityType" />
        <DxTreeListDataColumn FieldName="Year" DisplayFormat="d" />
        <DxTreeListDataColumn FieldName="RecordType" />
        <DxTreeListDataColumn FieldName="Population" />
    </Columns>
</DxTreeList>

@code {
    object Data { get; set; }
    IReadOnlyList<object> SelectedDataItems { get; set; }

    protected override async Task OnInitializedAsync() {
        var cities = await CitiesService.GetCitiesAsync();
        Data = new GridDevExtremeDataSource<Location>(cities.AsQueryable());
    }
}
See Also