We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Removing items from the DockingManager Control Array

Thread ID:





95759 Jul 29,2010 01:36 PM UTC Aug 18,2010 04:07 AM UTC WinForms 8
Tags: Tools
Matt Speller
Asked On July 29, 2010 01:36 PM UTC

Hi Guys,

Can you provide an example that shows how I can remove a control from the DockingManager so that the resource is released? When I close a control that is hosted by the docking manager, it remains part of the ControlsArray indefinately which is suboptimal.



Vallarasu S [Syncfusion]
Replied On July 30, 2010 10:07 AM UTC

Hi Matt,

Thanks for your interest in Syncfusion products,

Closing a window from the DockingManager sets the Windows dockVisibility to false, so that the window can be displayed again,
if you need to release the control from the DockingManager you can use SetEnableDockgin method of the docking manager as follows,

// removes and releases the control from the DockingMangaer
this.dockingManager1.SetEnableDocking(this.GroupBar1, false);

// releases the custom caption buttons that are used
BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.NonPublic;
FieldInfo fieldInfo = dockingManager1.GetType().GetField("htCustomCaptionButtons", bindingFlags);
if (fieldInfo != null)
Hashtable tab = fieldInfo.GetValue(dockingManager1) as Hashtable;

Refer the sample at the following link that demonstrates the above,


Please let us know if you have concerns on this.

Vallarasu S.

Matt Speller
Replied On August 3, 2010 11:11 AM UTC

Thank you very much for getting back to me. The method SetEnableDocking in the example works as expected but when implemented in our soultion I get exceptions thrown. I would like to confirm if the error is associated to the error refered to in this post - https://www.syncfusion.com/support/forums/tools-windows/15501/Docking-Manger-doesnot-remove-the-Control-permenently.

This is the line of code the causes the error -

private void OnDockVisibilityChanging(object sender, DockVisibilityChangingEventArgs arg)
Control smartPart = arg.Control;
this.dockManager.SetEnableDocking(smartPart, false);

Here is the call stack of the Syncfusion error generated (no custom code at all)

System.NullReferenceException: Object reference not set to an instance of an object.
at Syncfusion.Windows.Forms.Tools.DockHostController.CloseController()
at Syncfusion.Windows.Forms.Tools.DockHostController.set_DockVisibility(Boolean value)
at Syncfusion.Windows.Forms.Tools.DockHostController.HandleMouseUpImp(MouseButtons button, Point pt)
at Syncfusion.Windows.Forms.Tools.DockHost.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at Syncfusion.Windows.Forms.Tools.DockHost.WndProc(Message& msg)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Matt Speller
Replied On August 3, 2010 12:52 PM UTC

Sorry - I Forgot to mention we are currently on version

Lokanath E [Syncfusion]
Replied On August 4, 2010 11:03 AM UTC

Hi Matt,

Thanks for using Syncfusion products.

The forum post you have specified is about the same behavior. You can use DockVisibilityChanged event instead of DockVisibilityChanging event to release the control from the DockingManager using SetEnableDocking method.

Refer the sample at the following link. We hope it might help you.


Please let us know if you have any queries.


Matt Speller
Replied On August 9, 2010 02:43 PM UTC

Thanks for the update, using the Changed method intstead of the Changing method I submitted, I still got the same exception thrown. Back to my original question, is this the same issue suggested in the other post I mentioned and is this an area that has been fixed/modified since version 7?

Lokanath E [Syncfusion]
Replied On August 10, 2010 11:35 AM UTC

Hi Matt,

Thanks for your interest in Syncfusion products.

We deeply regret for the inconvenience. We are afraid that we could not reproduce the issue while using DockVisibilityChanged event to remove the reference from DockingManager with your mentioned version. Could you please try to reproduce the issue in previous provided sample or send us minimal sample that could be helpful for us to analyze the issue and provide a better solution.

We have attached a video file at the following link which I tried from previous provided sample.


Please let us know if you have any concern.


Matt Speller
Replied On August 17, 2010 11:43 AM UTC

Upgrading to 8.2 solved my issues, so I did just that.


Lingaraj S [Syncfusion]
Replied On August 18, 2010 04:07 AM UTC

Hi Matt,

Thank you for the update and your contribution in Syncfusion Community Forums.

Lingaraj S.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon