Class DockLayoutPanel
A layout panel that arranges child elements by docking them to specific edges of the available space with intelligent space management.
Inherited Members
Namespace: Telerik.WinControls.Layouts
Assembly: Telerik.WinControls.dll
Syntax
public class DockLayoutPanel : LayoutPanel, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IStylableNode
Remarks
Provides comprehensive docking functionality similar to WinForms DockStyle. Child elements can be positioned at Left, Right, Top, or Bottom edges with sequential docking behavior and optional LastChildFill mode where the final child fills remaining central space.
Constructors
DockLayoutPanel()
Declaration
public DockLayoutPanel()
Fields
DockProperty
LastChildFillProperty
Properties
LastChildFill
Gets or sets a value indicating whether the last child element should fill the remaining available space.
Declaration
public bool LastChildFill { get; set; }
Property Value
System.Boolean
|
Remarks
When LastChildFill
is enabled, the last child element in the collection will automatically
fill the center area that remains after all other children have been positioned according to
their dock settings. This is ideal for creating layouts where a main content area occupies
the remaining space.
When LastChildFill
is disabled, the last child element will be docked according to its
dock setting just like any other child, potentially leaving empty space in the center of the layout.
Changes to this property trigger a layout invalidation and re-arrangement of all child elements.
Methods
ArrangeOverride(SizeF)
Positions and sizes all child elements within the final layout area according to their dock positions.
Declaration
protected override SizeF ArrangeOverride(SizeF arrangeSize)
Parameters
System.Drawing.SizeF
arrangeSize
The final area within the parent that the panel should use to arrange itself and its children. |
Returns
System.Drawing.SizeF
The actual size used by the panel, which is the same as |
Overrides
Remarks
This method performs the final layout arrangement by:
- Processing child elements in collection order, giving earlier elements priority
- Positioning each element according to its dock setting (Left, Right, Top, Bottom)
- Reducing available space as each element is positioned
- Handling the last child element according to the LastChildFill setting
Docked elements are positioned at their respective edges and consume space in the corresponding direction, while the final element (when LastChildFill is enabled) occupies the remaining central area.
GetDock(RadElement)
Gets the dock position attached property value for the specified element.
Declaration
public static Dock GetDock(RadElement element)
Parameters
RadElement
element
The element to retrieve the dock position from. |
Returns
Dock
A Dock value indicating the element's docking position (Left, Right, Top, or Bottom). |
Remarks
This method retrieves the attached property that determines how the element will be positioned within the DockLayoutPanel. The dock position affects both the element's placement and how it influences the available space for other elements in the layout.
Exceptions
System.ArgumentNullException
Thrown when |
InitializeFields()
MeasureOverride(SizeF)
Measures the size required to accommodate all child elements with their docking constraints.
Declaration
protected override SizeF MeasureOverride(SizeF constraint)
Parameters
System.Drawing.SizeF
constraint
The maximum available size that the panel can use. |
Returns
System.Drawing.SizeF
A System.Drawing.SizeF representing the minimum size needed to display all child elements with their requested dock positions. |
Overrides
Remarks
This method implements the measurement logic for dock-based layout:
- Measures each child element with the remaining available space
- Accounts for space consumption based on dock positions (Left/Right consume width, Top/Bottom consume height)
- Calculates total space requirements for optimal layout
- Ensures that docked elements don't exceed available constraints
The measurement order follows the child collection sequence, where earlier elements take priority in space allocation, affecting the available space for subsequent elements.
SetDock(RadElement, Dock)
Sets the dock position attached property value for the specified element.
Declaration
public static void SetDock(RadElement element, Dock dock)
Parameters
RadElement
element
The element to set the dock position for. |
Dock
dock
The docking position to assign to the element. |
Remarks
This method sets the attached property that determines how the element will be positioned within the DockLayoutPanel. Setting this property will trigger a layout invalidation if the element is currently part of a DockLayoutPanel's visual tree.
Valid dock positions are:
Exceptions
System.ArgumentNullException
Thrown when |