New to Telerik UI for WinForms? Download free 30-day trial

Removing ToolWindow and DocumentWindow at Runtime

RadDock has two different methods which you can call if you want to remove a ToolWindow/DocumentWindow. The result from these methods depends on the CloseAction property which can have one of these values

  • Close: When a DockWindow has its CloseAction set to Close, this window is closed and detached (but not disposed) from its RadDock. You cannot manage it from RadDock collections anymore.

  • Hide: When a DockWindow has its CloseAction set to Hide, this window is only closed (hidden) in RadDock. However, this window is not detached from its RadDock and you can manage it from the RadDock collections.

  • CloseAndDispose: When a DockWindow has its CloseAction set to CloseAndDispose, this window is closed and then disposed.

RemoveWindow

This method closes and detaches (but does not dispose) a DockWindow regardless of its CloseAction property. This will happen if you pass only a DockWindow as a parameter. In addition, you can pass a CloseAction parameter. In this case, the RemoveWindow method will act differently in accordance with this parameter.

CloseWindow

This method has a different result on a DockWindow instance, in accordance with the CloseAction property of this instance.

Default behavior

DocumentWindow: If you do not set the CloseAction for a DocumentWindow and you close this DocumentWindow from the UI, this window is closed with CloseAction set to CloseAndDispose, i.e. the DocumentWindow is disposed and you cannot reuse it.

ToolWindow: If you do not set the CloseAction for a ToolWindow and you close the ToolWindow from the UI, this window is closed with CloseAction set to Hide, i.e. the ToolWindow is not disposed and you can reuse it later.

See Also

In this article