IContextMenuItemCollection.Add(Int32, String) Method
Adds a predefined item to the specified position in the item collection.
Namespace: DevExpress.Blazor.Office
Assembly: DevExpress.Blazor.v24.1.dll
NuGet Package: DevExpress.Blazor
Declaration
IContextMenuItem Add(
int index,
string name
)
Parameters
Name | Type | Description |
---|---|---|
index | Int32 | The position where to insert the item. |
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);
}
}
See Also