Back to Devexpress

BarGroupCollection.Add(Int32, String) Method

blazor-devexpress-dot-blazor-dot-office-dot-bargroupcollection-dot-add-x28-system-dot-int32-system-dot-string-x29.md

latest2.8 KB
Original Source

BarGroupCollection.Add(Int32, String) Method

Adds a predefined group to the specified position in the ribbon or toolbar.

Namespace : DevExpress.Blazor.Office

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public IBarGroup Add(
    int index,
    string name
)

Parameters

NameTypeDescription
indexInt32

The position where to insert the group.

| | name | String |

The name of the toolbar group or ribbon group to insert.

|

Returns

TypeDescription
IBarGroup

The inserted item group.

|

Remarks

The Add method overloads allow you to add a predefined group to a ribbon tab or toolbar. Use properties of the RichEditRibbonGroupNames and RichEditToolbarGroupNames classes to obtain names of all built-in ribbon and toolbar groups.

The following code snippet customizes the ribbon as follows:

razor
<DxRichEdit CustomizeRibbon=OnCustomizeRibbon />

@code {
    void OnCustomizeRibbon(IRibbon ribbon) {
        BarGroupCollection groups = ribbon.Tabs[0].Groups;
        // Inserts the Undo/Clipboard group at the end of the group collection
        groups.Add(RichEditRibbonGroupNames.HomeUndoClipboard);
        // Inserts the Full Screen group at the first position in the group collection
        groups.Add(0, RichEditRibbonGroupNames.ViewFullScreen);
    }
}

Run Demo: Toolbar CustomizationRun Demo: Ribbon Customization

See Also

BarGroupCollection Class

BarGroupCollection Members

DevExpress.Blazor.Office Namespace