skip navigation
  • Product Bundles

    DevCraft

    All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:

    • NEW: Design Kits for Figma
    • Online Training
    • Document Processing Library
    • Embedded Reporting for web and desktop

    Web

    Kendo UI UI for jQuery UI for Angular UI for React UI for Vue UI for Blazor UI for ASP.NET Core UI for ASP.NET MVC UI for ASP.NET AJAX

    Mobile

    UI for .NET MAUI

    Document Management

    Telerik Document Processing

    Desktop

    UI for .NET MAUI UI for WinUI UI for WinForms UI for WPF

    Reporting

    Telerik Reporting Telerik Report Server

    Testing & Mocking

    Test Studio Test Studio Dev Edition Telerik JustMock

    CMS

    Sitefinity

    UI/UX Tools

    ThemeBuilder Design System Kit Templates and Building Blocks

    Debugging

    Fiddler Fiddler Everywhere Fiddler Classic Fiddler Everywhere Reporter FiddlerCore

    Free Tools

    VB.NET to C# Converter Testing Framework
    View all products
  • Overview
  • Demos
    • What's New
    • Roadmap
    • Release History
  • Support and Learning

    • Support and Learning Hub
    • First Steps
    • Docs
    • Demos
    • Virtual Classroom
    • Use Reports in Applications
    • System Requirements
    • Forums
    • Videos
    • Blogs
    • Submit a Ticket
    • FAQs
  • Pricing
  • Shopping cart
    • Account Overview
    • Your Licenses
    • Downloads
    • Support Center
    • Forum Profile
    • Payment Methods
    • Edit Profile
    • Log out
  • Login
  • Contact Us
  • Try now
Search all

Class ElementTreeHelper

Provides utility methods that perform common tasks involving nodes in a LayoutElement tree.

Inheritance
System.Object
ElementTreeHelper
Namespace: Telerik.Reporting.Processing
Assembly: Telerik.Reporting.dll

Syntax

public static class ElementTreeHelper

Methods

ContainsChildWithName(LayoutElement, String)

Determines whether a parent layout element contains immediate child having a specified name.

Declaration
public static bool ContainsChildWithName(LayoutElement parent, string name)
Parameters
LayoutElement parent

The parent element to search within.

System.String name

The name to search for.

Returns
System.Boolean

true if an layout element having the specified parent and name is found; Otherwise, false.

Examples

This example shows how to determine if a child with name is contained in a ItemDataBinding event handler.

void DetailSection_ItemDataBinding_Using_ContainsChildWithName(object sender, EventArgs e)
{
    Processing.DetailSection processingInstance = (Processing.DetailSection)sender;
    if (Processing.ElementTreeHelper.ContainsChildWithName(processingInstance, "textBox1"))
    {
        processingInstance.Style.BackgroundColor = System.Drawing.Color.Blue;
    }
}
Private Sub DetailSection_ItemDataBinding_Using_ContainsChildWithName(sender As Object, e As EventArgs)
    Dim processingInstance As Processing.DetailSection = DirectCast(sender, Processing.DetailSection)
    If Processing.ElementTreeHelper.ContainsChildWithName(processingInstance, "textBox1") Then
        processingInstance.Style.BackgroundColor = System.Drawing.Color.Blue
    End If
End Sub

FindChildByName(LayoutElement, String, Boolean)

Searches for all layout elements with a specified name within a specified parent.

Declaration
public static LayoutElement[] FindChildByName(LayoutElement parent, string name, bool searchAllChildren)
Parameters
LayoutElement parent

The parent element to search within.

System.String name

The name to search for.

System.Boolean searchAllChildren

If true, all descendants within the specified parent are matched (deep search). Otherwise, only immediate children are matched.

Returns
LayoutElement[]

Array containing all matching by name children / descendants. If no elements are found an empty array is returned

Examples

This example shows how to find all children with name in a ItemDataBinding event handler.

void DetailSection_ItemDataBinding_Using_FindChildByName(object sender, EventArgs e)
{
    Processing.DetailSection processingInstance = (Processing.DetailSection)sender;
    Processing.LayoutElement[] elements = Processing.ElementTreeHelper.FindChildByName(processingInstance, "textBox1", true);
    foreach (Processing.LayoutElement child in elements)
    {
        Processing.VisualElement visualChild = child as Processing.VisualElement;
        if (null != visualChild)
        {
            visualChild.Style.BackgroundColor = System.Drawing.Color.Blue;
        }
    }
}
Private Sub DetailSection_ItemDataBinding_Using_FindChildByName(sender As Object, e As EventArgs)
    Dim processingInstance As Processing.DetailSection = DirectCast(sender, Processing.DetailSection)
    Dim elements As Processing.LayoutElement() = Processing.ElementTreeHelper.FindChildByName(processingInstance, "textBox1", True)
    For Each child As Processing.LayoutElement In elements
        Dim visualChild As Processing.VisualElement = TryCast(child, Processing.VisualElement)
        If visualChild IsNot Nothing Then
            visualChild.Style.BackgroundColor = System.Drawing.Color.Blue
        End If
    Next
End Sub

GetChildByIndex(LayoutElement, Int32)

Returns the immediate child layout element within a specified parent at specified index.

Declaration
public static LayoutElement GetChildByIndex(LayoutElement parent, int index)
Parameters
LayoutElement parent

The parent element to search within.

System.Int32 index

The zero-based index of the child to get.

Returns
LayoutElement

Layout element having the specified parent at the specified index.

Examples

This example shows how to access a child by index in a ItemDataBinding event handler.

void DetailSection_ItemDataBinding_Using_GetChildByIndex(object sender, EventArgs e)
{
    Processing.DetailSection processingInstance = (Processing.DetailSection)sender;
    Processing.LayoutElement child = Processing.ElementTreeHelper.GetChildByIndex(processingInstance, 0);
    Processing.VisualElement visualChild = child as Processing.VisualElement;
    if (null != visualChild)
    {
        visualChild.Style.BackgroundColor = System.Drawing.Color.Blue;
    }
}
Private Sub DetailSection_ItemDataBinding_Using_GetChildByIndex(sender As Object, e As EventArgs)
    Dim processingInstance As Processing.DetailSection = DirectCast(sender, Processing.DetailSection)
    Dim child As Processing.LayoutElement = Processing.ElementTreeHelper.GetChildByIndex(processingInstance, 0)
    Dim visualChild As Processing.VisualElement = TryCast(child, Processing.VisualElement)
    If visualChild IsNot Nothing Then
        visualChild.Style.BackgroundColor = System.Drawing.Color.Blue
    End If
End Sub

GetChildByName(LayoutElement, String)

Returns the first immediate child layout element within a specified parent having a specified name.

Declaration
public static LayoutElement GetChildByName(LayoutElement parent, string name)
Parameters
LayoutElement parent

The parent element to search within.

System.String name

The name to search for.

Returns
LayoutElement

Layout element having the specified name and parent.

Examples

This example shows how to get a child by name in a ItemDataBinding event handler.

void DetailSection_ItemDataBinding_Using_GetChildByName(object sender, EventArgs e)
{
    Processing.DetailSection processingInstance = (Processing.DetailSection)sender;
    Processing.LayoutElement child = Processing.ElementTreeHelper.GetChildByName(processingInstance, "textBox1");
    Processing.VisualElement visualChild = child as Processing.VisualElement;
    if (null != visualChild)
    {
        visualChild.Style.BackgroundColor = System.Drawing.Color.Blue;
    }
}
Private Sub DetailSection_ItemDataBinding_Using_GetChildByName(sender As Object, e As EventArgs)
    Dim processingInstance As Processing.DetailSection = DirectCast(sender, Processing.DetailSection)
    Dim child As Processing.LayoutElement = Processing.ElementTreeHelper.GetChildByName(processingInstance, "textBox1")
    Dim visualChild As Processing.VisualElement = TryCast(child, Processing.VisualElement)
    If visualChild IsNot Nothing Then
        visualChild.Style.BackgroundColor = System.Drawing.Color.Blue
    End If
End Sub

GetChildElements(LayoutElement)

Returns all immediate child layout elements within a specified parent.

Declaration
public static IEnumerable<LayoutElement> GetChildElements(LayoutElement parent)
Parameters
LayoutElement parent

The parent element.

Returns
System.Collections.Generic.IEnumerable<LayoutElement>

Enumerable of all layout elements having the specified parent. If the parent does not have children, an empty enumeration is returned.

Examples

This example shows how to access all children of a parent layout element in a ItemDataBinding event handler.

void DetailSection_ItemDataBinding_Using_GetChildElements(object sender, EventArgs e)
{
    Processing.DetailSection processingInstance = (Processing.DetailSection)sender;
    IEnumerable elements = Processing.ElementTreeHelper.GetChildElements(processingInstance);
    foreach (Processing.LayoutElement child in elements)
    {
        Processing.VisualElement visualChild = child as Processing.VisualElement;
        if (null != visualChild)
        {
            visualChild.Style.BackgroundColor = System.Drawing.Color.Blue;
        }
    }
}
Private Sub DetailSection_ItemDataBinding_Using_GetChildElements(sender As Object, e As EventArgs)
    Dim processingInstance As Processing.DetailSection = DirectCast(sender, Processing.DetailSection)
    Dim elements As System.Collections.Generic.IEnumerable(Of Processing.LayoutElement) = Processing.ElementTreeHelper.GetChildElements(processingInstance)
    For Each child As Processing.LayoutElement In elements
        Dim visualChild As Processing.VisualElement = TryCast(child, Processing.VisualElement)
        If visualChild IsNot Nothing Then
            visualChild.Style.BackgroundColor = System.Drawing.Color.Blue
        End If
    Next
End Sub

IndexOfChildWithName(LayoutElement, String)

Returns the zero-based index of the first occurrence of a layout element with a specified name within a parent.

Declaration
public static int IndexOfChildWithName(LayoutElement parent, string name)
Parameters
LayoutElement parent

The parent element to search within.

System.String name

The name to search for.

Returns
System.Int32

The zero-based index of the first occurrence of a layout element having the specified name within the specified parent.

Examples

This example shows how to get the index of a child in a ItemDataBinding event handler.

void DetailSection_ItemDataBinding_Using_IndexOfChildWithName(object sender, EventArgs e)
{
    Processing.DetailSection processingInstance = (Processing.DetailSection)sender;
    int index = Processing.ElementTreeHelper.IndexOfChildWithName(processingInstance, "textBox1");
    if (index >= 0)
    {
        Processing.LayoutElement child = Processing.ElementTreeHelper.GetChildByIndex(processingInstance, index);
        Processing.VisualElement visualChild = child as Processing.VisualElement;
        if (null != visualChild)
        {
            visualChild.Style.BackgroundColor = System.Drawing.Color.Blue;
        }
    }
}
Private Sub DetailSection_ItemDataBinding_Using_IndexOfChildWithName(sender As Object, e As EventArgs)
    Dim processingInstance As Processing.DetailSection = DirectCast(sender, Processing.DetailSection)
    Dim index As Integer = Processing.ElementTreeHelper.IndexOfChildWithName(processingInstance, "textBox1")
    If index >= 0 Then
        Dim child As Processing.LayoutElement = Processing.ElementTreeHelper.GetChildByIndex(processingInstance, index)
        Dim visualChild As Processing.VisualElement = TryCast(child, Processing.VisualElement)
        If visualChild IsNot Nothing Then
            visualChild.Style.BackgroundColor = System.Drawing.Color.Blue
        End If
    End If
End Sub
Getting Started
  • Install Now
  • Online Demos
Support Resources
  • Documentation
  • Knowledge Base
  • Videos
  • Reporting Samples Repository
  • Reporting Release History
Community
  • Forums
  • Blogs
  • Reporting Feedback Portal

Copyright © 2018 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.

OSZAR »