Skip to main content

BarContainerControl.Bars Property

Stores bar objects displayed by the current BarContainerControl.

Namespace: DevExpress.Xpf.Bars

Assembly: DevExpress.Xpf.Core.v22.2.dll

NuGet Package: DevExpress.Wpf.Core


public ObservableCollection<IBar> Bars { get; }

Property Value

Type Description

A collection of bar objects displayed by the current BarContainerControl.


This property is marked with the System.Windows.Markup.ContentPropertyAttribute attribute. So in XAML, objects defined between the BarContainerControl start and end tags are added to the Bars collection.

Elements of the Bars collection can be ToolBarControl, MainMenuControl, StatusBarControl and Bar objects.

Combining bar objects in a BarContainerControl serves the following purposes:

  • bar objects are automatically arranged without overlapping.
  • the drag-and-drop functionality is enabled for bars (except for main menus and status bars).

The following code places two bars in a BarContainerControl

        <dxb:BarButtonItem Content="First"/>
        <dxb:BarButtonItem Content="Second"/>
        <dxb:BarButtonItem Content="Third"/>

For Bar objects defined within a BarContainerControl, you can still use the Bar.DockInfo property (DockInfo.Column and DockInfo.Row) to specify the bar’s position.

The following code adds two Bar objects to a BarContainerControl. The first bar is defined in the BarManager.Bars collection. The second bar is defined in the Bars collection. Note the BarDockInfo.Column property set for these Bars to custom arrange them within the BarContainerControl.


If two bars are defined in the BarManager.Bars and BarContainerControl.Bars collection, respectively, and they have the same DockInfo.Row and DockInfo.Column settings, the bar placed inside the BarContainerControl.Bars collection will be displayed first, followed by the second bar.

        <dxb:Bar DockInfo="{dxb:DockInfo ContainerName=barContainer, Column=0}">
            <dxb:BarButtonItem Content="Item1"/>
            <dxb:BarButtonItem Content="Item2"/>
    <dxb:BarContainerControl x:Name="barContainer">
        <dxb:Bar DockInfo="{dxb:DockInfo Column=1}">
            <dxb:BarButtonItem Content="Item3"/>
            <dxb:BarButtonItem Content="Item4"/>
See Also