ClassBoxLayout
Represents a layout panel that arranges child elements in a horizontal or vertical box layout with proportional sizing support.
Definition
Namespace:Telerik.WinControls.Layouts
Assembly:Telerik.WinControls.dll
Syntax:
public class BoxLayout : LayoutPanel, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IStylableNode
Inheritance: objectDisposableObjectRadObjectRadElementLayoutPanelBoxLayout
Implements:
Inherited Members
Constructors
BoxLayout()
Declaration
public BoxLayout()
Fields
OrientationProperty
Identifies the Orientation dependency property.
Declaration
public static readonly RadProperty OrientationProperty
Field Value
Remarks
This property determines whether child elements are arranged horizontally (in a row) or vertically (in a column) within the layout container.
ProportionProperty
Identifies the ProportionProperty attached dependency property.
Declaration
public static RadProperty ProportionProperty
Field Value
Remarks
This property is attached to child elements to specify their proportional size relative to other children in the layout. A value of 0.0 means the element uses its desired size, while positive values indicate proportional sharing of available space.
StripPositionProperty
Identifies the BoxLayout.StripPosition dependency property.
Declaration
public static readonly RadProperty StripPositionProperty
Field Value
Remarks
This property determines the position where new elements are added to the layout container, affecting the visual ordering of child elements.
Properties
Orientation
Gets or sets the orientation of the box layout, determining whether child elements are arranged horizontally or vertically.
Declaration
public Orientation Orientation { get; set; }
Property Value
An Orientation value indicating the arrangement direction. The default value is Horizontal.
Remarks
When set to Horizontal, child elements are arranged side by side from left to right. When set to Vertical, child elements are arranged top to bottom.
Changing this property triggers a layout invalidation, causing all child elements to be repositioned according to the new orientation.
Methods
ArrangeOverride(SizeF)
arranges the children by a given criteria
GetProportion(RadElement)
Gets the proportion value of the specified element.
Declaration
public static float GetProportion(RadElement element)
Parameters
element
The element whose proportion value will be retrieved.
Returns
A float value representing the element's proportion relative to other elements in the layout.
Exceptions
Thrown when element is null.
Remarks
The proportion value determines how much of the available space an element should occupy relative to other elements. A value of 0.0 means the element uses its desired size, while positive values indicate proportional sharing of remaining space.
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 to layout the children
OnPropertyChanged(RadPropertyChangedEventArgs)
Handles the properties values changes of BoxLayout
Declaration
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
Parameters
e
Overrides
SetProportion(RadElement, float)
Sets the proportion value for the specified element (attached property).
Declaration
public static void SetProportion(RadElement element, float proportion)
Parameters
element
The element whose proportion value will be set.
proportion
The proportion value to assign to the element. Should be a positive value or 0.0.
Remarks
This method sets the attached property that controls how much space the element should occupy relative to other elements in the BoxLayout. The proportion value works as follows:
- 0.0: The element uses its desired/natural size
- Positive values: The element shares available space proportionally with other elements
For example, if three elements have proportions of 1.0, 2.0, and 1.0 respectively, the middle element will receive twice as much space as the other two.