Loading...
Loading...
Implement Syncfusion Blazor Dropdown Tree component for hierarchical data selection with single/multi-selection, checkboxes, filtering, and advanced customization. Use this skill whenever the user needs to display tree-structured data in a dropdown, select single or multiple hierarchical items, implement checkboxes for multi-item selection, filter tree data, customize templates, bind to remote data sources, or handle tree-related events and validation.
npx skill4agent add syncfusion/blazor-ui-components-skills syncfusion-blazor-dropdown-tree@using Syncfusion.Blazor.Navigations
<SfDropDownTree TItem="EmployeeData" TValue="string"
Placeholder="Select an employee"
Width="500px">
<DropDownTreeField TItem="EmployeeData"
DataSource="Data"
ID="Id"
Text="Name"
HasChildren="HasChild"
ParentID="PId">
</DropDownTreeField>
</SfDropDownTree>
@code {
List<EmployeeData> Data = new List<EmployeeData>
{
new EmployeeData() { Id = "1", Name = "Steven Buchanan", Job = "General Manager", HasChild = true, Expanded = true },
new EmployeeData() { Id = "2", PId = "1", Name = "Laura Callahan", Job = "Product Manager", HasChild = true },
new EmployeeData() { Id = "3", PId = "2", Name = "Andrew Fuller", Job = "Team Lead", HasChild = true },
new EmployeeData() { Id = "4", PId = "3", Name = "Anne Dodsworth", Job = "Developer" },
};
public class EmployeeData
{
public string? Id { get; set; }
public string? Name { get; set; }
public string? Job { get; set; }
public bool HasChild { get; set; }
public bool Expanded { get; set; }
public string? PId { get; set; }
}
}<SfDropDownTree TItem="EmployeeData" TValue="string"
ShowCheckBox="true"
AutoUpdateCheckState="true"
ShowSelectAll="true">
<DropDownTreeField TItem="EmployeeData" DataSource="Data"
ID="Id" Text="Name" HasChildren="HasChild" ParentID="PId">
</DropDownTreeField>
</SfDropDownTree><SfDropDownTree TItem="EmployeeData" TValue="string"
AllowMultiSelection="true"
@bind-Value="@SelectedIds">
<DropDownTreeField TItem="EmployeeData" DataSource="Data"
ID="Id" Text="Name" HasChildren="HasChild" ParentID="PId">
</DropDownTreeField>
</SfDropDownTree>
@code {
List<string> SelectedIds = new List<string>() { "1", "5" };
}<SfDropDownTree TItem="EmployeeData" TValue="string"
AllowFiltering="true"
FilterType="FilterType.Contains"
FilterBarPlaceholder="Search employees...">
<DropDownTreeField TItem="EmployeeData" DataSource="Data"
ID="Id" Text="Name" HasChildren="HasChild" ParentID="PId">
</DropDownTreeField>
</SfDropDownTree><SfDropDownTree TValue="int?" TItem="TreeData" Placeholder="Select an employee" Width="500px">
<DropDownTreeField TItem="TreeData" Query="@Query"
ID="EmployeeID" Text="FirstName" ParentID="ReportsTo" HasChildren="HasChildren">
<SfDataManager Url="https://services.odata.org/V4/Northwind/Northwind.svc"
Adaptor="Syncfusion.Blazor.Adaptors.ODataV4Adaptor"
CrossDomain="true">
</SfDataManager>
</DropDownTreeField>
</SfDropDownTree>
@code {
public Query Query = new Query();
}| Property | Type | Description |
|---|---|---|
| Generic | Model class for data items |
| Generic | Type of selected value(s) |
| List<TValue> | Two-way bindable selected values |
| IEnumerable | Local data source (via DropDownTreeField) |
| bool | Enable multi-node selection |
| bool | Display checkboxes for selection |
| bool | Auto-sync parent-child checkbox states |
| bool | Display select/deselect all checkbox |
| bool | Enable search filtering |
| FilterType | Filter matching strategy (StartsWith, EndsWith, Contains) |
| bool | Case-insensitive filtering |
| bool | Lazy-load child nodes on expand |
| string | Input placeholder text |
| string | Component width |
| string | Dropdown popup width |
| string | Dropdown popup height |
| int | CSS z-index of popup |
| string | Custom CSS classes |
| bool | Disable component interaction |