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.Add(String) Method

Adds a predefined item to the end of the item collection.

Namespace: DevExpress.Blazor.Office

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

#Declaration

C#
IContextMenuItem Add(
    string name
)

#Parameters

Name Type Description
name String

The item name.

#Returns

Type Description
IContextMenuItem

The inserted menu item.

#Remarks

Add method overloads allow you to add predefined items to the main context menu or its sub-menus. Use the RichEditContextMenuItemNames class properties to obtain names of all built-in items.

The following code snippet adds default Bring to Front and Bring in Front of Text items to the context menu:

Razor
<DxRichEdit CustomizeContextMenu=OnCustomizeContextMenu />

@code {
    void OnCustomizeContextMenu(IContextMenuItemCollection items) {
        // Inserts the "Bring to Front" item at the end of the item collection
        items.Add(RichEditContextMenuItemNames.BringToFront);
        // Inserts the "Bring in Front of Text" item at the first position in the item collection
        items.Add(0, RichEditContextMenuItemNames.BringInFrontOfText);
    }
}

RichEdit - Add default items to the context menu

Run Demo: Context Menu Customization

See Also