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. Image for the cookie policy date

How to Dispose of a docked control?

The user of my WinForms app has the opportunity to create a floating window at runtime. This window will be associated with the DockingManager. When the user clicks the close button ('X') on this dockable window, I want the window to be disposed of permanently [there would be no valid reason for the user to ever want to see the window again]. My question is how/when do I dispose of it? My current approach is to respond to the DockVisibilityChanged event which is fired when the user clicks the 'X'. I then call "arg.Control.Dispose()". This SEEMS to work -- but is this the correct approach? I've disposed of the window, but I'm not sure if I've disposed of the SyncFusion wrapper that makes the window dockable. Do I need to somehow inform the DockingManager that I've disposed of the window?

1 Reply

PS Prakash S Syncfusion Team March 9, 2003 10:02 PM UTC

Hi, If you intend to dispose off a dockable control, then it is necessary to call the DockingManager.SetEnableDocking(Control, bool) method on the particular control with a FALSE param before the dispose call. Instead of directly invoking SetEnableDocking from within the DockVisibilityChanged event handler, I would recommend that you keep track of all Controls that need to be disposed and then use some kind of an idle-time routine that examines and cleans up the hidden Controls periodically. Prakash Syncfusion

Loader.
Live Chat Icon For mobile
Up arrow icon