DockLayoutPanel
A layout panel that arranges child elements by docking them to specific edges of the available space with intelligent space management.
Definition
Namespace:Telerik.WinControls.Layouts
Assembly:Telerik.WinControls.dll
Syntax:
public class DockLayoutPanel : LayoutPanel, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IStylableNode
Inheritance: objectDisposableObjectRadObjectRadElementLayoutPanelDockLayoutPanel...
Derived Classes:
Implements:
Inherited Members
Constructors
public DockLayoutPanel()
Fields
public static RadProperty DockProperty
public static RadProperty LastChildFillProperty
Properties
Gets or sets a value indicating whether the last child element should fill the remaining available space.
public bool LastChildFill { get; set; }
true if the last child element should fill the remaining space after all other elements
have been docked; otherwise, false. The default value is true.
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
Positions and sizes all child elements within the final layout area according to their dock positions.
protected override SizeF ArrangeOverride(SizeF arrangeSize)
The final area within the parent that the panel should use to arrange itself and its children.
Returns:The actual size used by the panel, which is the same as arrangeSize.
Overrides:
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.
Gets the dock position attached property value for the specified element.
public static Dock GetDock(RadElement element)
The element to retrieve the dock position from.
Returns:A Dock value indicating the element's docking position (Left, Right, Top, or Bottom).
Exceptions:Thrown when element is null.
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.
Initializes member fields to their default values. This method is called prior the CreateChildItems one and allows for initialization of members on which child elements depend.
protected override void InitializeFields()
Overrides:
Measures the size required to accommodate all child elements with their docking constraints.
protected override SizeF MeasureOverride(SizeF constraint)
The maximum available size that the panel can use.
Returns:A SizeF representing the minimum size needed to display all child elements with their requested dock positions.
Overrides:
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.
Sets the dock position attached property value for the specified element.
public static void SetDock(RadElement element, Dock dock)
The element to set the dock position for.
dockDockThe docking position to assign to the element.
Exceptions:Thrown when element is null.
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: