Skip to main content

Bar Containers

  • 3 minutes to read

Bars in the DXBars for Silverlight suite can only be docked to bar containers (BarContainerControl). Thus, to allow bars to be docked to a window, bar containers must be added to that window. For instance, for bars to be docked to the top, left, right and bottom edges of a window, four bar containers must be added at these edges. A bar container is invisible, unless a bar is docked to a container.

BarContainer

NOTE

From version 10.1 onwards, by default, four bar containers are created along the four edges of the BarManager. This suits most typical scenarios for arranging bars. So, if you want to display bars only along the edges of the BarManager, there is no need to create bar containers manually. If you want to dock bars at another position, add a bar container at this position.

After bar containers have been created, you can associate a bar with it.

There is no need to create bar containers to make a bar floating. To make a bar floating, set the Bar.DockInfo.ContainerType (BarDockInfo.ContainerType) property to BarContainerType.Floating.

#Default Bar Containers

By default, the BarManager.CreateStandardLayout option is set to true. In this mode, four bar containers are created along the four edges of the BarManager. However, you are still able to manually create additional bar containers if required.

#Creating Bar Containers Manually

Manually, bar containers can be created in the same manner as any other control. Create BarContainerControl objects and position them according to your requirements. For instance, to display bars at the top and bottom edges of a window, create two bar containers at these edges.

#Adding Bars to Bar Containers

A bar can be docked to a bar container via settings provided by the Bar.DockInfo property as described below.

Bar containers created implicitly via the BarManager.CreateStandardLayout property have the ContainerType property set to BarContainerType.Top, BarContainerType.Left, BarContainerType.Right or BarContainerType.Bottom respectively. You can dock a bar to any of these containers by setting the Bar.DockInfo.ContainerType (BarDockInfo.ContainerType) property to a required container type.

When creating bar containers manually, you can initialize the bar container's type and name it via the BarContainerControl.ContainerType and Name properties. Then, you can bind a bar to a bar container by setting the Bar.DockInfo.ContainerType or Bar.DockInfo.ContainerName (BarDockInfo.ContainerName) property. In addition, you can bind a bar to a bar container by setting the Bar.DockInfo.Container (BarDockInfo.Container) property to the target container.

#Examples