BoxLayout
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
public BoxLayout()
Fields
Identifies the Orientation dependency property.
public static readonly RadProperty OrientationProperty
This property determines whether child elements are arranged horizontally (in a row) or vertically (in a column) within the layout container.
Identifies the ProportionProperty attached dependency property.
public static RadProperty ProportionProperty
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.
Identifies the BoxLayout.StripPosition dependency property.
public static readonly RadProperty StripPositionProperty
This property determines the position where new elements are added to the layout container, affecting the visual ordering of child elements.
Properties
Gets or sets the orientation of the box layout, determining whether child elements are arranged horizontally or vertically.
public Orientation Orientation { get; set; }
An Orientation value indicating the arrangement direction. The default value is Horizontal.
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
Gets the proportion value of the specified element.
public static float GetProportion(RadElement 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.
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.
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:
Handles the properties values changes of BoxLayout
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
Overrides:
Sets the proportion value for the specified element (attached property).
public static void SetProportion(RadElement element, float proportion)
The element whose proportion value will be set.
proportionfloatThe proportion value to assign to the element. Should be a positive value or 0.0.
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.