ClassDockLayoutPanel
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
DockLayoutPanel()
Declaration
public DockLayoutPanel()
Fields
LastChildFillProperty
Declaration
public static RadProperty LastChildFillProperty
Field Value
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
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.
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
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
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
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.
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.
InitializeFields()
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.
Declaration
protected override void InitializeFields()
Overrides
MeasureOverride(SizeF)
Measures the size required to accommodate all child elements with their docking constraints.
Declaration
protected override SizeF MeasureOverride(SizeF constraint)
Parameters
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
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
element
The element to set the dock position for.
dock
The docking position to assign to the element.
Exceptions
Thrown when element is null.
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: