Skip to main content

DockPanel.Item[Int32] Property

Provides indexed access to the child panels of the current panel.

Namespace: DevExpress.XtraBars.Docking

Assembly: DevExpress.XtraBars.v24.1.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

public DockPanel this[int index] { get; }

Parameters

Name Type Description
index Int32

A zero-based integer addressing the child panel.

Property Value

Type Description
DockPanel

A DockPanel object representing the desired child panel of the current panel.

Remarks

A dock panel can have multiple child panels which can be arranged side by side (split container) or as tab pages (tab container).

This property provides indexed access to the child panels of the current panel. The number of children the panel owns is determined by the DockPanel.Count property. The DockPanel.ParentPanel properties of the children refer to the parent panel.

To add a new child to the panel, use the DockPanel.AddPanel method. To add an existing panel as a child to another panel, the DockPanel.DockTo and DockPanel.DockAsTab methods can be used.

The parent panel’s DockPanel.Tabbed property allows you to control how child panels are arranged (as a split container or tab container).

Dock panels displayed within the dock manager’s form (the DockManager.Form property) can be obtained via the DockManager.RootPanels property.

Example

The following example demonstrates how to recursively iterate through the child panels of a specific panel. The IterateChildPanels method invokes the DoSomeOperation method for the last child of the specified panel (the child panel that doesn’t in turn contain any children).

using DevExpress.XtraBars.Docking;
// ...
void DoSomeOperation(DockPanel panel) {
   //...
}

void IterateChildPanels(DockPanel parentPanel) {
   if(parentPanel == null) return;
   for(int i = 0; i < parentPanel.Count; i++) {
      DockPanel childPanel = parentPanel[i];
      if(childPanel.Count == 0)
         DoSomeOperation(childPanel);
      else
         IterateChildPanels(childPanel);
   }
}
See Also