Skip to main content
All docs
V24.1

IContextMenuItemCollection.Flatten() Method

Converts the item collection into a flattened collection that contains all root-level and nested items of the context menu.

Namespace: DevExpress.Blazor.Office

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

IEnumerable<IContextMenuItem> Flatten()

Returns

Type Description
IEnumerable<IContextMenuItem>

The flattened collection of all menu items.

Remarks

The Flatten() method recursively iterates through the item collection and collects all root-level and nested items.

The following code snippet removes icons for all items in the context menu (including sub-menus):

<DxRichEdit CustomizeContextMenu=OnCustomizeContextMenu/>

@code {
    void OnCustomizeContextMenu(IContextMenuItemCollection items) {
        foreach (var item in items.Flatten()) {
            item.IconUrl = string.Empty;
        }
    }
}

RichEdit - Flattened items

See Also