menu

Blazor

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class DropDownTreeField<TItem> - Blazor API Reference | Syncfusion

    Show / Hide Table of Contents

    Class DropDownTreeField<TItem>

    A class used for configuring the Dropdown Tree fields setting properties.

    Inheritance
    System.Object
    DropDownTreeField<TItem>
    Namespace: Syncfusion.Blazor.Navigations
    Assembly: Syncfusion.Blazor.dll
    Syntax
    public class DropDownTreeField<TItem> : OwningComponentBase
    Type Parameters
    Name Description
    TItem

    Specifies the type of DropDownTreeField<TItem>.

    Constructors

    DropDownTreeField()

    Declaration
    public DropDownTreeField()

    Properties

    Child

    Gets or sets the string value that represents the name of the child data source holding a list of objects.

    Declaration
    public string Child { get; set; }
    Property Value
    Type Description
    System.String

    The value denotes the name of child data in assigned data source. The default value is null.

    Examples
    @using Syncfusion.Blazor.DropDowns
    <SfDropDownTree TItem="string" TValue="TreeItem">
       <DropDownTreeField TItem="string" DataSource="TreeDataSource" Id="NodeId" Text="NodeText" Expanded="Expanded" Child="@("Child")"></DropDownTreeField>
    </SfDropDownTree>
    
    @code {
        List<TreeItem> TreeDataSource = new List<TreeItem>();
        protected async override Task OnInitializedAsync()
        {
            await base.OnInitializedAsync();
            TreeDataSource.Add(new TreeItem
            {
                NodeId = "01",
                NodeText = "Local Disk (C:)",
                Expanded = true,
                Child = new List<TreeItem>()
                {
                    new TreeItem { NodeId = "01-01", NodeText = "Program Files",
                    Child = new List<TreeItem>()
                    {
                        new TreeItem { NodeId = "01-01-01", NodeText = "Windows NT" },
                        new TreeItem { NodeId = "01-01-02", NodeText = "Windows Mail" },
                    },
                },
            },
            });
            }
             public class TreeItem
             {
                public string NodeId { get; set; }
                public string NodeText { get; set; }
                public string Icon { get; set; }
                public bool Expanded { get; set; }
                public bool Selected { get; set; }
                public List<TreeItem> Child { get; set; }
              }
        }

    DataManager

    The DataManager class provides functionality for performing data operations in applications. It serves as an abstraction layer for working with remote data sources.

    Declaration
    public DataManager DataManager { get; set; }
    Property Value
    Type Description
    DataManager

    Map the remote data details for the component using this property.

    DataSource

    Gets or sets the data source for rendering the DropDownTree component. The data source value can be of any type that implements IEnumerable.

    Declaration
    public IEnumerable<TItem> DataSource { get; set; }
    Property Value
    Type Description
    System.Collections.Generic.IEnumerable<TItem>

    The value can be any IEnumerable list of data. The default value is null.

    Expanded

    Gets or sets the mapping field for the expand state of the tree node in the popup.

    Declaration
    public string Expanded { get; set; }
    Property Value
    Type Description
    System.String

    true if the node must be expanded during initial rendering. The default value is false

    HasChildren

    Gets or sets the mapping field for determining whether a node has child nodes or not.

    Declaration
    public string HasChildren { get; set; }
    Property Value
    Type Description
    System.String

    true if the node contains child nodes. The default value is false

    HtmlAttributes

    Gets or sets the mapping field for adding custom HTML attributes to the tree node in the popup.

    Declaration
    public string HtmlAttributes { get; set; }
    Property Value
    Type Description
    System.String

    Specifies the additional attribute to be added for the required tree nodes.

    Examples
    @using Syncfusion.Blazor.Navigations
    
    <SfDropDownTree TItem="EmployeeData" TValue="string" Width="100%" CssClass="custom" Placeholder="Select an employee" PopupHeight="250px">
        <DropDownTreeField TItem="EmployeeData" DataSource="Data" Id="Id" Text="Name" HasChildren="HasChild" ParentID="PId" HtmlAttributes="htmlAttribute"></DropDownTreeField>
    </SfDropDownTree>
    
    @code {
        public class EmployeeData
        {
            public string Id { get; set; }
            public string Name { get; set; }
            public string Job { get; set; }
            public string Image { get; set; }
            public bool HasChild { get; set; }
            public bool Expanded { get; set; }
            public string Status { get; set; }
            public string PId { get; set; }
            public Dictionary<string, object> htmlAttribute { get; set; }
        }
    
        List<EmployeeData> Data = new List<EmployeeData>
        {
            new EmployeeData() {Id="1", Name = "Steven Buchanan",  Job = "General Manager", Image= "10",HasChild=true,Expanded=true,Status="busy",htmlAttribute=new Dictionary<string, object>() { {"style", "background-color: yellow;"},   } },
            new EmployeeData() {Id="2",PId="1", Name = "Laura Callahan",  Job = "Product Manager", Image= "2",HasChild=true,Status="online" }
        };
    }

    IconCss

    Gets or sets the mapping field for the icon class of each tree node, which will be added before the node's text.

    Declaration
    public string IconCss { get; set; }
    Property Value
    Type Description
    System.String

    Specifies the CSS class names to render icons for tree nodes.

    ID

    Gets or sets the Id field mapped in the dataSource.

    Declaration
    public string ID { get; set; }
    Property Value
    Type Description
    System.String

    Specifies the id field of tree node. The default value is null

    ImageUrl

    Gets or sets the mapping field for the image URL of each tree node, where the image will be added before the node's text in the popup.

    Declaration
    public string ImageUrl { get; set; }
    Property Value
    Type Description
    System.String

    Specifies the url for the image that must be loaded in the required tree node.

    IsChecked

    Gets or sets the field for the checked state of the tree node in the popup.

    Declaration
    public string IsChecked { get; set; }
    Property Value
    Type Description
    System.String

    The checked state of tree node during initial rendering. The default value is false

    Level

    Gets or sets the DropDownTree field level.

    Declaration
    public int Level { get; set; }
    Property Value
    Type Description
    System.Int32

    Accepts the Integer value. The default value is 0.

    ParentID

    Gets or sets the parent ID field mapped in the dataSource.

    Declaration
    public string ParentID { get; set; }
    Property Value
    Type Description
    System.String

    The parent ID of the corresponding node to which the node must be mapped as children. The default value is null

    Query

    Gets or sets the query to select particular data from the dataSource.

    Declaration
    public Query Query { get; set; }
    Property Value
    Type Description
    Query

    The set of data that must be queried from the entire data source. The default value is null

    Selected

    Gets or sets the mapping field for the selected state of the tree node.

    Declaration
    public string Selected { get; set; }
    Property Value
    Type Description
    System.String

    Specifies the selected state of node during initial rendering. The default value is false

    TableName

    Gets or sets the table name used to fetch data from a specific table in the server.

    Declaration
    public string TableName { get; set; }
    Property Value
    Type Description
    System.String

    The table name to fetch data.

    Text

    Gets or sets the mapping field for the text displayed as the tree node's display text.

    Declaration
    public string Text { get; set; }
    Property Value
    Type Description
    System.String

    The text to be displayed in tree node.

    Tooltip

    Gets or sets the mapping field for the tooltip that will be displayed as hovering text of the tree node.

    Declaration
    public string Tooltip { get; set; }
    Property Value
    Type Description
    System.String

    The tooltip that must be shown during node hover.

    Methods

    BuildRenderTree(RenderTreeBuilder)

    Declaration
    protected override void BuildRenderTree(RenderTreeBuilder __builder)
    Parameters
    Type Name Description
    Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder

    Dispose(Boolean)

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    OnInitializedAsync()

    Declaration
    protected override Task OnInitializedAsync()
    Returns
    Type
    System.Threading.Tasks.Task

    OnParametersSetAsync()

    Declaration
    protected override Task OnParametersSetAsync()
    Returns
    Type
    System.Threading.Tasks.Task
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved