Skip to main content

BarItemCollection.Add(String) Method

Adds a predefined item to the ribbon or toolbar.

Namespace: DevExpress.Blazor.Office

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public IBarItem Add(
    string name
)

Parameters

Name Type Description
name String

The item name.

Returns

Type Description
IBarItem

The inserted bar item.

Remarks

The Add method overloads allow you to add a predefined item to a ribbon or toolbar group. Use the RichEditBarItemNames class properties to obtain names of all built-in items.

The code below customizes the ribbon as follows:

<DxRichEdit CustomizeRibbon=OnCustomizeRibbon />

@code {
    void OnCustomizeRibbon(IRibbon ribbon) {
        IRibbonTab insertTab = ribbon.Tabs[RichEditRibbonTabNames.Insert];
        IBarGroup group = insertTab.Groups[RichEditRibbonGroupNames.InsertHeaderAndFooter];
        // Inserts the Insert Time Field item at the end of the item collection
        group.Items.Add(RichEditBarItemNames.InsertTimeField);
        // Inserts the Insert Date Field item at the first position in the item collection
        group.Items.Add(0, RichEditBarItemNames.InsertDateField);
    }
}

Add Default Items

Run Demo: Toolbar Customization Run Demo: Ribbon Customization

See Also