[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
 [Expand]What's Installed
 [Expand].NET Core 3 Support
 [Expand]Common Concepts
 [Expand]MVVM Framework
 [Collapse]Controls and Libraries
  [Expand]Data Grid
  [Collapse]Ribbon, Bars and Menu
   [Expand]Common Features
    [Expand]Ribbon Structure
    [Collapse]Populating Ribbon
      Items and Links
      Ribbon Galleries
      Bar Item Display Options
      Bar Item Behavior Options
      MVVM Support
    [Expand]Ribbon Menu
     Runtime Customization
  [Expand]Charts Suite
  [Expand]Pivot Grid
  [Expand]Rich Text Editor
  [Expand]Tree List
  [Expand]Gauge Controls
  [Expand]Map Control
  [Expand]Layout Management
  [Expand]Windows Modern UI
  [Expand]Data Editors
  [Expand]Navigation Controls
  [Expand]Spell Checker
  [Expand]Property Grid
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Gantt Control
  [Expand]Diagram Control
  [Expand]Windows and Utility Controls
   Dialogs, Notifications and Panels
  [Expand]Scheduler (legacy)
 [Expand]Scaffolding Wizard
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Items and Links

Expanded What are Bar Items

If you look at ribbon page groups, the status bar or the Quick Access Toolbar, you may see various visual elements (command buttons, static text, editors, menus, galleries, etc.), each of which provides specific functionality.

To add a command button, static text or any other element to a RibbonControl, RibbonStatusBarControl, any bar or popup menu you need to create a specific bar item. Bar items provide multiple display and behavior options that can be customized: content, large and small images, a command and event that occur when corresponding elements are clicked, etc. For instance, to add a regular button to a Ribbon, you need to create a BarButtonItem object. Its Content and Glyph properties allow you to assign a specific content and image to the button. The item's BarItem.ItemClick event allows you to implement the button's functionality. You can specify a command for a bar item by using the BarItem.Command property.

The following code defines two buttons in the Ribbon Control's Home page.

For simplicity, no command or event handler is assigned to buttons in this example. See Bar Item Behavior Options to learn how to assign actions to bar items.

There are multiple bar item types that can be used to add various elements to Ribbon controls. The BarButtonItem mentioned above is used to create regular buttons. The BarSubItem object is used to add a submenu, etc. For a complete list of bar items, see The List of Bar Items and Links.

Expanded What are Bar Item Links

In specific cases, you may want to add the same command (e.g., button) in multiple places. For instance, you may want to add the Open button to the Home tab and to the Ribbon Quick Access Toolbar at the same time. The two buttons should have the same caption, hint and image, and invoke the same action. Bar item links come into play in these scenarios.

A bar item link is a visual element that refers to a specific bar item (using the BarItemLinkBase.BarItemName property). It is rendered onscreen using the settings of the source bar item, and it acts like the source bar item, as it is aware of the item's settings and action assigned. You can create multiple links to the same bar item and display them in different places. Clicking on either of them will invoke the same event handler or command that is assigned to the source bar item.

For each bar item type, there is a corresponding bar item link object. For instance, the BarButtonItemLink is a link that corresponds to the BarButtonItem object. See The List of Bar Items and Links, for more information.

The following code defines three bar items in the Home page and adds links to these items on the Quick Access Toolbar, Page Header region and Ribbon Status Bar.

Expanded See Also

Is this topic helpful?​​​​​​​