Skip to main content
All docs
V25.2
  • IContextMenuItemCollection.Remove(Int32) Method

    Removes an item with the specified index from an item collection.

    Namespace: DevExpress.Blazor

    Assembly: DevExpress.Blazor.v25.2.dll

    NuGet Package: DevExpress.Blazor

    Declaration

    bool Remove(
        int index
    )

    Parameters

    Name Type Description
    index Int32

    Item index.

    Returns

    Type Description
    Boolean

    true if the item is removed; otherwise, false.

    Remarks

    Handle the CustomizeContextMenu event to modify context commands available in the Grid, Rich Text Editor, or TreeList component. In the event handler, call the Remove method to remove an item from the menu item collection.

    The following code snippet removes items from the main context menu:

    <DxRichEdit CustomizeContextMenu="OnCustomizeContextMenu"/>
    
    @code {
        void OnCustomizeContextMenu(IContextMenuItemCollection items) {
            // Removes the first item
            items.Remove(0);
            // Removes the "Decrease Indent" item
            items.Remove(RichEditContextMenuItemNames.DecreaseIndent);
        }
    }
    

    Refer to CustomizeContextMenu event descriptions for additional information and examples:

    See Also