Home Forums WinForms controls Other WinForms controls DockingWindows on a Control Reply To: DockingWindows on a Control

User (Old forums)
Post count: 23064

We have found a way to make this work. However, note that using the DLM in a UserControl is not a scenario that we support. That is, the DLM assumes it is in a form, and initializing it without such a form is not intended.

You need to set the state of the ToolWindow to Dock before adding it to the ToolWindows collection.

oTW.State = ToolWindowState.Docked;
//Then Add the toolwindow obj to the layoutmanager
_layoutManager.ToolWindows.Add( oTW );

The reason for this is that when the TW state is floating, the DLM looks for the main form, and does not find it. When set to Dock, it will not look for the main form.

This workaround is fine at form load, but any modification to the DLM / TW later in the application may not work. Basically, this is a scenario that we do not support, and you are using it “at your own risk”, if I may say.

Imported from legacy forums. Posted by André (had 414 views)