New to Telerik UI for WinFormsStart a free 30-day trial

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:

C#
[TypeConverter(typeof(ExpandableObjectConverter))]
public class RadElementTree : IDisposable

Inheritance: objectRadElementTree

Derived Classes: ComponentThemableElementTree

Implements: IDisposable

Constructors

Initializes a new instance of the RadElementTree class.

C#
public RadElementTree(IComponentTreeHandler component)
Parameters:componentIComponentTreeHandler

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.

C#
public IComponentTreeHandler ComponentTreeHandler { get; }
Property Value:

The IComponentTreeHandler that manages this element tree.

Gets the Windows Forms control that hosts this element tree.

C#
[TypeConverter(typeof(ExpandableObjectConverter))]
public Control Control { get; }
Property Value:

The Control instance that contains this element tree.

Gets a value indicating whether the element tree is currently being disposed.

C#
public bool Disposing { get; }
Property Value:

true if the tree is disposing; otherwise, false.

Gets a value indicating whether layout operations are currently suspended.

C#
public bool IsLayoutSuspended { get; }
Property Value:

true if layout is suspended; otherwise, false.

Remarks:

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.

C#
[Browsable(true)]
[TypeConverter(typeof(ExpandableObjectConverter))]
public RootRadElement RootElement { get; }
Property Value:

The RootRadElement that serves as the root of the element hierarchy.

Remarks:

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.

Gets the unique name of this element tree.

C#
public string TreeName { get; }
Property Value:

A string representing the tree name, typically in the format "VisualTree" followed by an instance number.

Methods

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

C#
public void Dispose()

Implements: IDisposable.Dispose()

Releases the unmanaged resources used by the RadElementTree and optionally releases the managed resources.

C#
protected virtual void Dispose(bool disposing)
Parameters:disposingbool

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.

C#
public RadElement GetElementAtPoint(Point point, Predicate<RadElement> predicate)
Parameters:pointPoint

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:

RadElement

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.

C#
public RadElement GetElementAtPoint(Point point)
Parameters:pointPoint

The coordinates to test, in control coordinates.

Returns:

RadElement

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.

C#
public T GetElementAtPoint<T>(Point point) where T : class
Parameters:pointPoint

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.

C#
public virtual Size GetPreferredSize(Size proposedSize, Size sizeConstraints)
Parameters:proposedSizeSize

The proposed size for the control.

sizeConstraintsSize

Size constraints to apply during calculation.

Returns:

Size

The preferred Size for the control.

Remarks:

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.

C#
public virtual void InitializeRootElement()
Remarks:

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.

C#
public virtual void OnAutoSizeChanged(EventArgs e)
Parameters:eEventArgs

The event arguments.

Remarks:

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.

C#
public Size PerformInnerLayout(bool performMeasure, int x, int y, int width, int height)
Parameters:performMeasurebool

Whether to perform the measure phase of layout.

xint

The x-coordinate for layout.

yint

The y-coordinate for layout.

widthint

The width for layout.

heightint

The height for layout.

Returns:

Size

The resulting Size after layout.

Remarks:

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.

C#
public void PerformLayout()
Remarks:

This method triggers a complete layout cycle including measure and arrange phases, and updates the control's size based on the layout results.