Skip to main content
A newer version of this page is available. .

DockPanel.Index Property

Gets or sets the position of the dock panel within the owning collection.

Namespace: DevExpress.XtraBars.Docking

Assembly: DevExpress.XtraBars.v19.1.dll

Declaration

[Browsable(false)]
public int Index { get; set; }

Property Value

Type Description
Int32

A zero-based integer specifying the position of the current panel within the owning collection.

Remarks

You can use the Index property to change the panel’s position with respect to its sibling panels. Changing the Index property doesn’t modify the panel’s dock style (left, top, right or bottom). To dock a panel at a specific position using a specific dock style, the DockPanel.DockTo overload can be used which takes the index parameter.

Child panels within a tab container or split container are counted from top to bottom and from left to right. The number of child panels within the parent panel is specified by the DockPanel.Count property. A child panel’s Index property reflects the position of the panel within its container.

DockPanel_Index_Containers

DockPanel_Index_Containers_Vert

Visible root panels specified by the DockManager.RootPanels collection are panels which aren’t owned by any panels. These include the floating panels and panels docked to the form (or user control) which is referred to by the DockManager.Form property.

For these panels the Index property reflects the position of the panel within the root panel collection and this also determines the panel’s position amongst the other sibling panels.

Assuming that the root panel collection doesn’t contain any floating panels the root panels docked to the form are indexed as follows.

A panel which entirely occupies the form’s edge has the smallest index (0). A second dock panel can be docked only within the region which is not occupied by the first panel. The second panel has an index of 1. The images below show two panels docked to the left and top, respectively. In the first image the panel docked on the left has an index of 0, the index of the top-docked panel is 1. In the second image the panels’ indexes are reversed.

DockPanel_Index_2Panels DockPanel_Index_2Panels1

Another panel can be docked only within the region not occupied by the first and second panels. Its index is 2. Below are the possible variants on how the third panel can be docked.

DockPanel_Index_3Panels

When an end-user docks a panel at a specific position, its position in the DockManager.RootPanels collection and therefore its Index are changed to reflect the new layout.

Changing the panel’s Index property will move the panel according to the described arrangement rules.

For hidden panels and panels which have their auto hide feature enabled, the Index property is always set to -1.

See Also