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

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.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

#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):

Razor
<DxRichEdit CustomizeContextMenu=OnCustomizeContextMenu/>

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

RichEdit - Flattened items

See Also