TreeListDataRowCommandContext Class
Contains contextual information for a TreeList data row context menu.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v25.2.dll
NuGet Package: DevExpress.Blazor
Declaration
public class TreeListDataRowCommandContext :
GridDataRowCommandContextBase,
ITreeListCommandContext,
ICommandContextBase
Remarks
The DevExpress Blazor TreeList allows you to display context menus with predefined and custom commands. Use the ContextMenus property to activate context menus for specific TreeList elements.

Handle the CustomizeContextMenu event to modify the menu item collection. Use the Context event argument to identify the target TreeList element and obtain contextual information.
| Target Element | Context Type | Contextual information |
|---|---|---|
| Any | ITreeListCommandContext | TreeList |
| Data Row | TreeListDataRowCommandContext |
TreeList, Column, DataItem, RowVisibleIndex |
| Footer | TreeListFooterCommandContext | TreeList, Column, SummaryItems |
| Header | TreeListHeaderCommandContext | TreeList, Column |
Example
The following code snippet adds custom commands to the row context menu associated with selection cells:
@inject EmployeeTaskService EmployeeTaskService
<DxTreeList Data="TreeListData"
KeyFieldName="Id"
ParentKeyFieldName="ParentId"
ContextMenus="TreeListContextMenus.DataRow"
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) {
if (args.Context is TreeListDataRowCommandContext rowContext
&& rowContext.Column is ITreeListSelectionColumn) {
args.Items.AddCustomItem("Select All", async () => {
args.TreeList.BeginUpdate();
await args.TreeList.SelectAllAsync();
args.TreeList.EndUpdate();
});
args.Items.AddCustomItem("Deselect All", async () => {
args.TreeList.BeginUpdate();
await args.TreeList.DeselectAllAsync();
args.TreeList.EndUpdate();
});
args.Items.AddCustomItem("Select All on Page", () => {
args.TreeList.BeginUpdate();
args.TreeList.SelectAllOnPage();
args.TreeList.EndUpdate();
});
args.Items.AddCustomItem("Deselect All on Page", () => {
args.TreeList.BeginUpdate();
args.TreeList.DeselectAllOnPage();
args.TreeList.EndUpdate();
});
}
}
}
Inheritance
Object
DevExpress.Blazor.Grid.Internal.Base.ContextMenu.GridCommandContextBase
DevExpress.Blazor.Grid.Internal.Base.ContextMenu.GridHeaderCommandContextBase
DevExpress.Blazor.Grid.Internal.Base.ContextMenu.GridDataRowCommandContextBase
TreeListDataRowCommandContext
See Also