windowsforms-2516-controls-and-libraries-ribbon-bars-and-menu-ribbon-items-and-item-links-button-groups.md
Bar items can be arranged into groups. The WinForms Ribbon control supports item groups and button groups.
Enable the bar item’s BeginGroup option to display a vertical line before a bar item.
barButtonItem1.Links[0].BeginGroup = true;
barButtonItem1.Links(0).BeginGroup = True
A button group (BarButtonGroup) displays multiple bar items in a line. Bar items can display only small images. Button groups are not broken or collapsed when the width of the Ribbon Control changes.
The following animation demonstrates how to create a button group at design time.
using DevExpress.XtraBars;
/* Assigns an SVG icon collection to the Ribbon control.
* The collection contains three icons: left, center, right.
*/
ribbonControl1.Images = svgImageCollection1;
// Creates and initializes three bar items.
BarButtonItem barItemLeft = new BarButtonItem(ribbonControl1.Manager, "Left", 0);
BarButtonItem barItemCenter = new BarButtonItem(ribbonControl1.Manager, "Center", 1);
BarButtonItem barItemRight = new BarButtonItem(ribbonControl1.Manager, "Right", 2);
// Creates a button group with bar items.
BarButtonGroup buttonGroup = new BarButtonGroup(ribbonControl1.Manager, new BarButtonItem[] {
barItemLeft, barItemCenter, barItemRight
});
// Adds the button group to a page group.
ribbonPageGroup2.ItemLinks.Add(buttonGroup);
Imports DevExpress.XtraBars
' Assigns an SVG icon collection to the Ribbon control.
' The collection contains three icons: left, center, right.
ribbonControl1.Images = svgImageCollection1
' Creates and initializes three bar items.
Dim barItemLeft As New BarButtonItem(ribbonControl1.Manager, "Left", 0)
Dim barItemCenter As New BarButtonItem(ribbonControl1.Manager, "Center", 1)
Dim barItemRight As New BarButtonItem(ribbonControl1.Manager, "Right", 2)
' Creates a button group with bar items.
Dim buttonGroup As New BarButtonGroup(ribbonControl1.Manager, New BarButtonItem() { barItemLeft, barItemCenter, barItemRight })
' Adds the button group to a page group.
ribbonPageGroup2.ItemLinks.Add(buttonGroup)
See Also