Skip to main content
All docs
V25.1
  • IContextMenuItemCollection.Add(String) Method

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

    Namespace: DevExpress.Blazor.Office

    Assembly: DevExpress.Blazor.v25.1.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    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:

    <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