Back to Devexpress

How To: Organize Bar Items into Categories

windowsforms-1098-controls-and-libraries-ribbon-bars-and-menu-bars-runtime-customization-and-layout-management-how-to-organize-bar-items-into-categories.md

latest1.9 KB
Original Source

How To: Organize Bar Items into Categories

  • Oct 29, 2020

Categories are bar item groups that can only be viewed by end-users inside the Customization Window dialog.

The most handy way to add categories at design time is utilizing the Customization Window dialog. To invoke it, right-click a Bar Manager and select “Customize”.

Same dialog allows you to group bar items into categories. To do so, click the default “(Unassigned Items)” category and drag-and-drop items to the desired one.

To categorize items in code, create a BarManagerCategory object and add it to the BarManager.Categories collection. Then, assign this category to the BarItem.Category properties of all required bar items.

csharp
BarManagerCategory cAlignment = new BarManagerCategory();
cAlignment.Name = "Alignment";
barManager1.Categories.Add(cAlignment);
bbiAlignCenter.Category = bbiAlignJustify.Category = bbiAlignLeft.Category =
    bbiAlignRight.Category = cAlignment;
vb
Dim cAlignment As New BarManagerCategory()
cAlignment.Name = "Alignment"
barManager1.Categories.Add(cAlignment)
bbiAlignRight.Category = cAlignment
bbiAlignLeft.Category = bbiAlignRight.Category
bbiAlignJustify.Category = bbiAlignLeft.Category
bbiAlignCenter.Category = bbiAlignJustify.Category