Button Groups
- 2 minutes to read
Bar items can be arranged into groups. The WinForms Ribbon control supports item groups and button groups.
Bar Item Groups
Enable the bar item’s BeginGroup option to display a vertical line before a bar item.
Button Groups
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);
See Also