Class
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:

cs-api-definition
[TypeConverter(typeof(ExpandableObjectConverter))]
public class RadElementTree : IDisposable

Inheritance: objectRadElementTree

Derived Classes: ComponentThemableElementTree

Implements: IDisposable

Constructors

RadElementTree(IComponentTreeHandler)

Initializes a new instance of the RadElementTree class.

Declaration

cs-api-definition
public RadElementTree(IComponentTreeHandler component)

Parameters

component

IComponentTreeHandler

The component tree handler that manages this element tree.

Properties

ComponentTreeHandler

Gets the component tree handler that bridges the abstract RadElement layout and the RadControl instance.

Declaration

cs-api-definition
public IComponentTreeHandler ComponentTreeHandler { get; }

Property Value

IComponentTreeHandler

The IComponentTreeHandler that manages this element tree.

Control

Gets the Windows Forms control that hosts this element tree.

Declaration

cs-api-definition
[TypeConverter(typeof(ExpandableObjectConverter))]
public Control Control { get; }

Property Value

Control

The Control instance that contains this element tree.

Disposing

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

Declaration

cs-api-definition
public bool Disposing { get; }

Property Value

bool

true if the tree is disposing; otherwise, false.

IsLayoutSuspended

Gets a value indicating whether layout operations are currently suspended.

Declaration

cs-api-definition
public bool IsLayoutSuspended { get; }

Property Value

bool

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.

RootElement

Gets the root element of the element tree.

Declaration

cs-api-definition
[Browsable(true)]
[TypeConverter(typeof(ExpandableObjectConverter))]
public RootRadElement RootElement { get; }

Property Value

RootRadElement

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.

TreeName

Gets the unique name of this element tree.

Declaration

cs-api-definition
public string TreeName { get; }

Property Value

string

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

Methods

Dispose()

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

Declaration

cs-api-definition
public void Dispose()

Implements IDisposable.Dispose()

Dispose(bool)

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

Declaration

cs-api-definition
protected virtual void Dispose(bool disposing)

Parameters

disposing

bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

GetElementAtPoint(Point)

Gets the element at the specified coordinates that handles mouse input.

Declaration

cs-api-definition
public RadElement GetElementAtPoint(Point point)

Parameters

point

Point

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.

GetElementAtPoint(Point, Predicate<RadElement>)

Gets the element at the specified coordinates that meets the predicate criteria.

Declaration

cs-api-definition
public RadElement GetElementAtPoint(Point point, Predicate<RadElement> predicate)

Parameters

point

Point

The coordinates to test, in control coordinates.

predicate

Predicate<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.

GetElementAtPoint<T>(Point)

Gets the first element of the specified type at the given coordinates that handles mouse input.

Declaration

cs-api-definition
public T GetElementAtPoint<T>(Point point) where T : class

Parameters

point

Point

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.

GetPreferredSize(Size, Size)

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.

Declaration

cs-api-definition
public virtual Size GetPreferredSize(Size proposedSize, Size sizeConstraints)

Parameters

proposedSize

Size

The proposed size for the control.

sizeConstraints

Size

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.

InitializeRootElement()

Initializes the root element of the tree and creates the initial element hierarchy.

Declaration

cs-api-definition
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.

OnAutoSizeChanged(EventArgs)

Handles the AutoSize property change event of the associated control.

Declaration

cs-api-definition
public virtual void OnAutoSizeChanged(EventArgs e)

Parameters

e

EventArgs

The event arguments.

Remarks

This method updates the layout when AutoSize changes and notifies the root element of the AutoSize state change.

PerformInnerLayout(bool, int, int, int, int)

Performs the internal layout operation with specified parameters.

Declaration

cs-api-definition
public Size PerformInnerLayout(bool performMeasure, int x, int y, int width, int height)

Parameters

performMeasure

bool

Whether to perform the measure phase of layout.

x

int

The x-coordinate for layout.

y

int

The y-coordinate for layout.

width

int

The width for layout.

height

int

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.

PerformLayout()

Performs a layout operation on the element tree using the control's current bounds.

Declaration

cs-api-definition
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.