Accessing Bar Items and Links
- 2 minutes to read
At design time, you can easily access the elements of the RibbonControl: Ribbon pages, Ribbon page groups, a status bar and individual bar items. When you click a specific command button (bar item link) within a Ribbon Page, this command displays a smart tag button in the top right corner. Invoke this smart tag to quickly modify most relevant link settings.
You can also use the RibbonControl’s Designer to access bar items and customize their settings at design time.
In traditional bars that come with the DevExpress Ribbon, Menu and Docking Library, it’s possible to customize settings of specific bar item links and override the settings of the corresponding bar items. The Ribbon Control doesn’t allow you to customize the settings of bar item links. All the required information used to paint bar item links is retrieved from a bar item object.
The only link’s property that can be customized at design time is the BarItemLink.BeginGroup. This specifies whether the current link must be separated from preceding links by a vertical line. When a link is selected on a form or using the Designer, the Properties window displays all the settings of the corresponding bar item, plus the link’s BeginGroup property.
To access bar items and links in code, use the following properties:
|RibbonControl.Items||Provides access to the bar items that can be used within the RibbonControl. Bar items created at design time are automatically added to this collection. If bar items are created in code, they must be added to the collection manually. See this property for more information.|
|RibbonPageGroup.ItemLinks||Represents the collection of bar item links displayed within the current Ribbon page group.|
|RibbonQuickAccessToolbar.ItemLinks||Represents the collection of bar item links displayed within the Quick Access Toolbar.|
|RibbonStatusBar.ItemLinks||Represents the collection of bar item links displayed within the current Ribbon Status Bar.|
|BarItemLink.Item||Allows you to access the bar item represented by the current link.|
See the How to: Create a RibbonControl in Code for an example of creating a Ribbon Control and customizing it in code.