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

Creating a RadDock at Runtime

To create a RadDock in code, construct a RadDock, set properties and add to the controls collection of the form. The example below creates a RadDock, adds it to the form and docks a single ToolWindow to it. See DockWindows for more information on instantiating DockWindow at runtime.

WinForms RadDock Creating a RadDock at Runtime

Creating a simple RadDock instance

RadDock radDock1 = new RadDock();
radDock1.Dock = DockStyle.Fill;
this.Controls.Add(radDock1);
ToolWindow toolWindow1 = new ToolWindow();
toolWindow1.Text = "A ToolWindow";
radDock1.DockWindow(toolWindow1, DockPosition.Left);

Dim radDock1 As RadDock = New RadDock()
radDock1.Dock = DockStyle.Fill
Me.Controls.Add(radDock1)
Dim toolWindow1 As ToolWindow = New ToolWindow()
toolWindow1.Text = "A ToolWindow"
radDock1.DockWindow(toolWindow1, DockPosition.Left)

You cannot set the DockPosition of the ToolWindow to Fill, unless you specify a target ToolWindow. If you try to set the DockPosition of a ToolWindow to Fill when there is no target ToolWindow, we throw an exception since a ToolWindow cannot fill RadDock entirely. This behavior is by design and it is the same as it is in Visual Studio. If you want to have a ToolWindow occupying RadDock entirely, you should dock it to a side (left/right/top/bottom) and set MainDocumentContainerVisible to false.

See Also

In this article