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 Count property. The ParentPanel properties of the children refer to the parent panel.
To add a new child to the panel, use the
AddPanel method. To add an existing panel as a child to another panel, the
DockTo and
DockAsTab methods can be used.
The parent panel's 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.
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).
C# |
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);
}
}
|
VB |
Imports DevExpress.XtraBars.Docking
Sub DoSomeOperation(ByVal panel As DockPanel)
End Sub
Sub IterateChildPanels(ByVal parentPanel As DockPanel)
If parentPanel Is Nothing Then Return
Dim i As Integer
For i = 0 To parentPanel.Count - 1
Dim childPanel As DockPanel = parentPanel(i)
If childPanel.Count = 0 Then
DoSomeOperation(childPanel)
Else
IterateChildPanels(childPanel)
End If
Next
End Sub
|