DockPanel.Count Property

Gets the number of dock panels the current dock panel owns.

Namespace: DevExpress.XtraBars.Docking

Assembly: DevExpress.XtraBars.v20.1.dll

Declaration

[Browsable(false)]
[XtraSerializableProperty]
public int Count { get; }
<Browsable(False)>
<XtraSerializableProperty>
Public ReadOnly Property Count As Integer

Property Value

Type Description
Int32

An integer value specifying the number of dock panels contained within the current dock panel.

Remarks

Dock panels can own panels, these child panels can in turn own other panels. This provides the ability to create a nested layout of dock panels. The panel's Count property returns how many immediate child panels a panel contains, not the total number of panels (secondary child panels) residing within it.

Examples

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