Articles in this section
Category / Section

How to access the collection of dock-enabled controls in WinForms Docking Manager?

1 min read

Collection of dock enabled control

The DockingManager.Controls property returns an enumerator that may be used for accessing the controls that are currently associated with the DockingManager.

If you want to modify the DockingManager’s control set in any way, then the contents of the enumerator should first be copied to a temporary collection. The following sample shows an implementation that disables docking and disposes of all the dockable controls.

C#

IEnumerator ienum = this.dockingManager1.Controls;
ArrayList dockedctrls = new ArrayList();
while(ienum.MoveNext())
dockedctrls.Add(ienum.Current);
foreach(Control ctrl in dockedctrls)
{
   this.dockingManager1.SetEnableDocking(ctrl, false);
   ctrl.Dispose();
}

 

VB

Dim ienum As IEnumerator = Me.dockingManager1.Controls
Dim dockedctrls As ArrayList = New ArrayList()
Do While ienum.MoveNext()
dockedctrls.Add(ienum.Current)
Loop
Dim ctrl As Control
For Each ctrl In dockedctrls
    Me.dockingManager1.SetEnableDocking(ctrl, False)
    ctrl.Dispose()
Next

 

Reference link: https://help.syncfusion.com/windowsforms/dockingmanager/dock-window#enabledisable-dock-functionality

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied