TreeListContextMenuDefaultItemNames.CollapseAll Field
The Collapse All item’s name.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.Grid.v26.1.dll
NuGet Package: DevExpress.Blazor
Declaration
public const string CollapseAll = "CollapseAll"
Field Value
| Type | Description |
|---|---|
| String | The “CollapseAll” string. |
Remarks
Specify the ContextMenus property to display context menus for the following TreeList elements:

Collapse All is a TreeList context menu item that collapses all rows. This item is not available in context menus by default.
Use the CollapseAll field to apply the following customizations:
Example
The following code snippet adds Expand All/Collapse All items to all context menus:
@inject EmployeeTaskService EmployeeTaskService
<DxTreeList Data="TreeListData"
KeyFieldName="Id"
ParentKeyFieldName="ParentId"
ContextMenus="TreeListContextMenus.All"
CustomizeContextMenu="CustomizeContextMenu">
<Columns>
<DxTreeListSelectionColumn Width="80px" />
<DxTreeListDataColumn FieldName="Name" Caption="Task" />
<DxTreeListDataColumn FieldName="EmployeeName" />
<DxTreeListDataColumn FieldName="StartDate" />
<DxTreeListDataColumn FieldName="DueDate" />
</Columns>
</DxTreeList>
@code {
List<EmployeeTask> TreeListData { get; set; }
protected override void OnInitialized() {
TreeListData = EmployeeTaskService.GenerateData();
}
void CustomizeContextMenu(TreeListCustomizeContextMenuEventArgs args) {
args.Items.Add(TreeListContextMenuDefaultItemNames.CollapseAll);
args.Items.Add(TreeListContextMenuDefaultItemNames.ExpandAll);
}
}
See Also