RadElementTree
Represents the visual element tree for a Telerik control. Every Telerik control has a corresponding tree of RadElements. This provides flexibility in building controls and enables property inheritance from ancestor nodes.
Definition
Namespace:Telerik.WinControls
Assembly:Telerik.WinControls.dll
Syntax:
[TypeConverter(typeof(ExpandableObjectConverter))]
public class RadElementTree : IDisposable
Inheritance: objectRadElementTree
Derived Classes:
Implements:
Constructors
Initializes a new instance of the RadElementTree class.
public RadElementTree(IComponentTreeHandler component)
The component tree handler that manages this element tree.
Properties
Gets the component tree handler that bridges the abstract RadElement layout and the RadControl instance.
public IComponentTreeHandler ComponentTreeHandler { get; }
The IComponentTreeHandler that manages this element tree.
Gets the Windows Forms control that hosts this element tree.
[TypeConverter(typeof(ExpandableObjectConverter))]
public Control Control { get; }
The Control instance that contains this element tree.
Gets a value indicating whether the element tree is currently being disposed.
public bool Disposing { get; }
true if the tree is disposing; otherwise, false.
Gets a value indicating whether layout operations are currently suspended.
public bool IsLayoutSuspended { get; }
true if layout is suspended; otherwise, false.
Layout suspension is used to improve performance during bulk operations by preventing unnecessary layout calculations until the operations are complete.
Gets the root element of the element tree.
[Browsable(true)]
[TypeConverter(typeof(ExpandableObjectConverter))]
public RootRadElement RootElement { get; }
The RootRadElement that serves as the root of the element hierarchy.
The root element is the top-level container for all visual elements in the control. It manages the overall layout and serves as the entry point for element tree operations.
Methods
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Implements:
Releases the unmanaged resources used by the RadElementTree and optionally releases the managed resources.
protected virtual void Dispose(bool disposing)
true to release both managed and unmanaged resources;
false to release only unmanaged resources.
Gets the element at the specified coordinates that meets the predicate criteria.
public RadElement GetElementAtPoint(Point point, Predicate<RadElement> predicate)
The coordinates to test, in control coordinates.
predicatePredicate<RadElement>A predicate function to test each element, or null to return the first element found.
Returns:The RadElement that meets the criteria, or null if no suitable element is found.
Gets the element at the specified coordinates that handles mouse input.
public RadElement GetElementAtPoint(Point point)
The coordinates to test, in control coordinates.
Returns:The RadElement at the specified point that can handle mouse input, or null if no suitable element is found.
Gets the first element of the specified type at the given coordinates that handles mouse input.
public T GetElementAtPoint<T>(Point point) where T : class
The coordinates to test, in control coordinates.
Returns:T
The element of type T at the specified point, or null if no suitable element is found.
Calculates the preferred size of the control based on the element tree layout. This method is called when AutoSize is true to determine the optimal control size.
public virtual Size GetPreferredSize(Size proposedSize, Size sizeConstraints)
The proposed size for the control.
sizeConstraintsSizeSize constraints to apply during calculation.
Returns:The preferred Size for the control.
This method considers stretch properties of the root element and performs measure and arrange operations to determine the optimal size.
Initializes the root element of the tree and creates the initial element hierarchy.
public virtual void InitializeRootElement()
This method creates the root element if it doesn't exist, initializes it through the component tree handler, and sets up the initial child elements. It also manages layout suspension during initialization to improve performance.
Handles the AutoSize property change event of the associated control.
public virtual void OnAutoSizeChanged(EventArgs e)
The event arguments.
This method updates the layout when AutoSize changes and notifies the root element of the AutoSize state change.
Performs the internal layout operation with specified parameters.
public Size PerformInnerLayout(bool performMeasure, int x, int y, int width, int height)
Whether to perform the measure phase of layout.
xintThe x-coordinate for layout.
yintThe y-coordinate for layout.
widthintThe width for layout.
heightintThe height for layout.
Returns:The resulting Size after layout.
This method handles the core layout logic including measure, arrange, and size calculation while respecting AutoSize settings and stretch properties.
Performs a layout operation on the element tree using the control's current bounds.
public void PerformLayout()
This method triggers a complete layout cycle including measure and arrange phases, and updates the control's size based on the layout results.