How to Create a Ribbon Control at Design Time
- 3 minutes to read
The Ribbon is designed as a band located at the top of the application window. It represents commands in a tabbed format. Each tab combines commands by their common functionality. Commands in a tab are visually separated into tab groups by tasks.
To organize commands around a task, a tab group is designed as a dock container for a toolbar containing related commands (bar items).
To build a new Ribbon in your application, you first need to create toolbars and bar items using the bar manager component. To do this:
Drop the bar manager component from the Component Palette’s ExpressBars page onto the form.
Use the Customization Form to create toolbars and bar items. To invoke the Customization Form, double click the bar manager icon located on the form. For information on how to create both bars and items, see the Customization Form topic.
Drop the Ribbon control from the Component Palette’s ExpressBars page onto the form. The Ribbon is automatically linked to the bar manager (see the Ribbon’s BarManager property).
By default, one tab is already available in the Ribbon. To create additional tabs, select the Ribbon and, in the Object Inspector, click the ellipsis button next to the Ribbon’s Tabs property. Alternatively, use the tab’s context menu. To create a new tab with the menu, right click any Ribbon tab and select the Add Tab item.
Select the tab and name it as required (using the tab’s Caption property). To create groups in the tab page, click the ellipsis button next to the tab’s Groups property. Alternatively, use the tab’s context menu (the Add Empty Group or Add Group With Toolbar menu item).
Select the tab group and, in the Object Inspector, using the tab group’s ToolBar property, link the corresponding toolbar to the group. When docked, the toolbar’s caption (see the bar’s Caption property) is automatically assigned to the tab group’s title.
Along with the Ribbon, the new UI offers two more areas, located at the top-left corner of the application window:
The Quick Access Toolbar allows users to access frequently used commands regardless of the active Ribbon tab. Like tab groups, the Quick Access Toolbar is a dock container for these commands. To dock a toolbar to the Quick Access Toolbar, assign the toolbar to the Ribbon control’s QuickAccessToolbar.Toolbar property.
The Ribbon Tab Area Toolbar (available in the Office 2019 Ribbon, Office 2016 Ribbon, and Office 2016 Tablet Ribbon styles) and the Ribbon Tab Area Search Toolbar. These toolbars host important commands for quick user access without navigating through tabs or tab groups. As with the Ribbon Quick Access Toolbar, the toolbars are dock containers for toolbars containing these commands. To dock a toolbar to the Ribbon Tab Area Toolbar or Ribbon Tab Area Search Toolbar, use the Ribbon’s TabAreaToolbar.Toolbar or TabAreaSearchToolbar.Toolbar property.