How to dock child control between two Docking Manager?
Docking Manager supports to dock its child control into another Docking Manager. It can be achieved by using its functions named AddToTargetManagersList and RemoveFromTargetManagersList.
This function helps to interconnect two Docking Manager, so that its child controls can be docked between two Docking Manager.
This function helps to remove interconnection between two Docking Manager.
The following code example demonstrates the same.
//To set the docked controls that transformed to child controls. Form2 ChildWindow = new Form2(); ChildWindow.Show(); this.dockingManager1.AddToTargetManagersList(ChildWindow.dockingManager1); ChildWindow.dockingManager1.AddToTargetManagersList(this.dockingManager1); //To remove DockingManager from MainForm's TargetManagerList. ChildWindow.dockingManager1.RemoveFromTargetManagersList(this.dockingManager1); this.dockingManager1.RemoveFromTargetManagersList(ChildWindow.dockingManager1);
'To set the docked controls, that transformed to child controls. ChildWindow = New Form2() ChildWindow.Show() Me.dockingManager1.AddToTargetManagersList(ChildWindow.dockingManager1) ChildWindow.dockingManager1.AddToTargetManagersList(Me.dockingManager1) 'To remove DockingManager from MainForm's TargetManagerList. ChildWindow.dockingManager1.RemoveFromTargetManagersList(Me.dockingManager1) Me.dockingManager1.RemoveFromTargetManagersList(ChildWindow.dockingManager1)
In AddToTargetManagersList, specifying a DockingManager as a target provider in, target list allows the docked controls that being dragged and dropped onto the docking layout hosted by the target manager.
Figure 1: DockingManager2 controls docked in DockingManager1 by using AddToTargetManagersList.
Figure 2: DockingManager1 controls docked into DockingManager1 by using AddToTargetManagersList.
Figure 3: TargetManagerList has been removed by using the RemoveFromTargetManagersList method.