BarContainerControl.Bars Property
Stores bar objects displayed by the current BarContainerControl.
Namespace: DevExpress.Xpf.Bars
Assembly: DevExpress.Xpf.Core.v24.2.dll
NuGet Package: DevExpress.Wpf.Core
#Declaration
public ObservableCollection<IBar> Bars { get; }
#Property Value
Type | Description |
---|---|
Observable |
A collection of bar objects displayed by the current Bar |
#Remarks
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:BarContainerControl>
<dxb:ToolBarControl>
<dxb:BarButtonItem Content="First"/>
<dxb:BarButtonItem Content="Second"/>
</dxb:ToolBarControl>
<dxb:Bar>
<dxb:BarButtonItem Content="Third"/>
</dxb:Bar>
</dxb:BarContainerControl>
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.
Note
If two bars are defined in the Bar
<dxb:BarManager>
<dxb:BarManager.Bars>
<dxb:Bar DockInfo="{dxb:DockInfo ContainerName=barContainer, Column=0}">
<dxb:BarButtonItem Content="Item1"/>
<dxb:BarButtonItem Content="Item2"/>
</dxb:Bar>
</dxb:BarManager.Bars>
<dxb:BarContainerControl x:Name="barContainer">
<dxb:Bar DockInfo="{dxb:DockInfo Column=1}">
<dxb:BarButtonItem Content="Item3"/>
<dxb:BarButtonItem Content="Item4"/>
</dxb:Bar>
</dxb:BarContainerControl>
</dxb:BarManager>