A specialized layout panel that arranges two child elements in a caption-body relationship with configurable positioning.
Definition
Namespace:Telerik.WinControls.Layouts
Assembly:Telerik.WinControls.dll
Syntax:
public class ElementWithCaptionLayoutPanel : LayoutPanel, IDisposable, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IStylableNode
Inheritance: objectDisposableObjectRadObjectRadElementLayoutPanelElementWithCaptionLayoutPanel...
Implements:
Inherited Members
Constructors
public ElementWithCaptionLayoutPanel()
Fields
public static RadProperty CaptionElementProperty
public static RadProperty CaptionOnTopProperty
public static RadProperty ShowCaptionProperty
Properties
Gets or sets a value indicating whether the caption element should be positioned above the body element.
public bool CaptionOnTop { get; set; }
true if the caption should be positioned at the top; false if it should be positioned at the bottom.
The default value is false.
When CaptionOnTop is true, the caption element is arranged at the top of the layout area
and the body element occupies the remaining space below. When false, the body element fills
the upper area and the caption is positioned at the bottom.
Changing this property triggers a layout invalidation, causing all child elements to be repositioned according to the new arrangement.
Gets or sets a value indicating whether the caption element should be visible and participate in layout.
public bool ShowCaption { get; set; }
true if the caption should be visible and allocated space in the layout; false if it should be hidden.
The default value is true.
When ShowCaption is set to false, the caption element's visibility is set to
Collapsed, causing it to be completely removed from the layout
calculations. The body element will then occupy the entire available space.
Setting this property to true restores the caption element's visibility to
Visible and re-includes it in layout calculations.
This property automatically initializes elements when changed to ensure proper caption and body identification.
Methods
Positions and sizes the caption and body elements within the final layout area according to the current configuration.
protected override SizeF ArrangeOverride(SizeF finalSize)
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 finalSize.
Overrides:
This method performs the final layout arrangement by:
- Initializing and identifying caption and body elements
- Calculating space requirements for both elements
- Positioning elements based on the CaptionOnTop setting
- Ensuring minimum caption height of 8 pixels when visible
- Distributing remaining space to the body element
The caption element receives its desired height (minimum 8 pixels), while the body element gets the remaining vertical space. Both elements span the full width of the layout area.
Measures the size required to accommodate both caption and body elements within the specified constraints.
protected override SizeF MeasureOverride(SizeF availableSize)
The maximum available size that the panel can use.
Returns:A SizeF representing the minimum size needed to display both caption and body elements, constrained by the available size.
Overrides:
This method calculates the total space requirements by:
- Initializing and identifying caption and body elements
- Measuring both elements using the base measurement logic
- Calculating combined width (maximum of both elements) and height (sum of both elements)
- Constraining the result within the available size limits
The resulting size ensures that both elements can be displayed with their desired dimensions, with the width being the maximum needed by either element and the height being the sum of both.
Raises the RadPropertyChanged event and the standard .NET PropertyChanged event to notify subscribers of property value changes.
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
The RadPropertyChangedEventArgs containing information about the property change.
Overrides: