Class
TreeBinding

Provides base functionality for configuring data binding in hierarchical Telerik components such as PanelBar, TreeView, and Menu. Define field mappings between your data model properties and component item properties to control how data is displayed. Use this to specify which fields contain item text, icons, URLs, parent-child relationships, and other hierarchical data structure elements.

Definition

Namespace:Telerik.Blazor.Components.Common.Trees

Assembly:Telerik.Blazor.dll

Syntax:

cs-api-definition
public abstract class TreeBinding : ComponentBase, IComponent, IHandleEvent, IHandleAfterRender, IDisposable

Inheritance: objectComponentBaseTreeBinding

Derived Classes: PanelBarBindingTreeViewBinding

Implements: IComponentIDisposableIHandleAfterRenderIHandleEvent

Inherited Members ComponentBase.BuildRenderTree(RenderTreeBuilder)ComponentBase.OnInitializedAsync()ComponentBase.OnParametersSet()ComponentBase.StateHasChanged()ComponentBase.ShouldRender()ComponentBase.OnAfterRender(bool)ComponentBase.OnAfterRenderAsync(bool)ComponentBase.InvokeAsync(Action)ComponentBase.InvokeAsync(Func<Task>)ComponentBase.DispatchExceptionAsync(Exception)ComponentBase.SetParametersAsync(ParameterView)

Constructors

TreeBinding()

Declaration

cs-api-definition
protected TreeBinding()

Properties

HasChildrenField

Specifies the data field name that indicates whether an item has child items, optimizing performance by avoiding unnecessary child data loading. Set to a boolean field that returns true when an item has children and false when it's a leaf node. This is particularly useful for load-on-demand scenarios. Example: "HasChildren", "HasSubItems", or "IsParent". This parameter is required and cannot be null - an "ArgumentNullException" will be thrown if not specified.

Declaration

cs-api-definition
[Parameter]
public string HasChildrenField { get; set; }

Property Value

string

IconField

Specifies the data field name that contains icon identifiers or CSS classes for displaying icons next to PanelBar item text. Icons enhance visual hierarchy and help users quickly identify different types of content or categories. Can contain Telerik icon names, Font Awesome classes, or custom CSS icon classes. Example: "IconClass", "Icon", or "ImageUrl". This parameter is required and cannot be null - an "ArgumentNullException" will be thrown if not specified.

Declaration

cs-api-definition
[Parameter]
public string IconField { get; set; }

Property Value

string

IdField

Specifies the data field name that contains unique identifiers for each data item. This field is essential for tracking item state, establishing parent-child relationships, and managing component performance. The value should be unique across all items in your data set. Example: "Id", "Key", or "UniqueIdentifier". This parameter is required and cannot be null - an "ArgumentNullException" will be thrown if not specified.

Declaration

cs-api-definition
[Parameter]
public string IdField { get; set; }

Property Value

string

ItemsField

Specifies the data field name that contains the collection of child items for hierarchical data structures. Use this when your data is organized as nested objects where each parent contains an array or list of child items. The field should contain an IEnumerable collection of the same data type. Example: "Items", "Children", or "SubCategories". This parameter is required and cannot be null - an "ArgumentNullException" will be thrown if not specified.

Declaration

cs-api-definition
[Parameter]
public string ItemsField { get; set; }

Property Value

string

Level

Specifies the hierarchical level in the data structure where this binding configuration should be applied. Set to null for the default binding that applies to all levels, or specify a number (0, 1, 2, etc.) to target a specific level. Level 0 represents root items, level 1 represents first-level children, and so on. Example: Level = 1 for second-level items.

Declaration

cs-api-definition
[Parameter]
public int? Level { get; set; }

Property Value

int?

ParentIdField

Specifies the data field name that contains the parent identifier for establishing hierarchical relationships in flat data structures. Use this when your data is stored as a flat list where each item references its parent through an ID field. The value should match the IdField of the parent item. Example: "ParentId", "ManagerId", or "CategoryId". This parameter is required and cannot be null - an "ArgumentNullException" will be thrown if not specified.

Declaration

cs-api-definition
[Parameter]
public string ParentIdField { get; set; }

Property Value

string

TextField

Specifies the data field name that contains the display text for PanelBar item headers. This text appears in the clickable header area of each panel item and represents the main content label users will see. Example: "Title", "Name", "Label", or "DisplayText". This parameter is required and cannot be null - an "ArgumentNullException" will be thrown if not specified.

Declaration

cs-api-definition
[Parameter]
public string TextField { get; set; }

Property Value

string

UrlField

Specifies the data field name that contains navigation URLs for PanelBar items that should function as links. When an item with a URL is clicked, the application will navigate to the specified address. Can contain relative URLs (e.g., "/products"), absolute URLs (e.g., "https://example.com"), or hash links (e.g., "#section1"). This parameter is required and cannot be null - an "ArgumentNullException" will be thrown if not specified.

Declaration

cs-api-definition
[Parameter]
public string UrlField { get; set; }

Property Value

string

Methods

Dispose()

Declaration

cs-api-definition
public void Dispose()

Implements IDisposable.Dispose()

OnInitialized()

Declaration

cs-api-definition
protected override void OnInitialized()

Overrides ComponentBase.OnInitialized()

OnParametersSetAsync()

Declaration

cs-api-definition
protected override Task OnParametersSetAsync()

Returns

Task

Overrides ComponentBase.OnParametersSetAsync()

ThrowIfParameterIsNull(object, string)

Declaration

cs-api-definition
protected void ThrowIfParameterIsNull(object argumentValue, string argumentName)

Parameters

argumentValue

object

argumentName

string