Skip to main content
All docs
V24.1

DxTreeList.Data Property

Specifies a data source.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[DefaultValue(null)]
[Parameter]
public object Data { get; set; }

Property Value

Type Default Description
Object null

A data source.

Remarks

Use the Data property to bind the TreeList component to a data source that implements the IEnumerable or IListSource interface. Initialize this data source in the OnInitialized or OnInitializedAsync lifecycle method. Refer to the following topic for more information: Bind Blazor TreeList to Data.

The following example binds the TreeList component to a flat data source:

@inject EmployeeTaskService EmployeeTaskService

<DxTreeList Data="TreeListData" KeyFieldName="Id" ParentKeyFieldName="ParentId">
    <Columns>
        <DxTreeListDataColumn FieldName="Name" Caption="Task" />
        <DxTreeListDataColumn FieldName="EmployeeName" />
        <DxTreeListDataColumn FieldName="StartDate" />
        <DxTreeListDataColumn FieldName="DueDate" />
    </Columns>
</DxTreeList>

@code {
    List<EmployeeTask> TreeListData { get; set; }

    protected override void OnInitialized() {
        TreeListData = EmployeeTaskService.GenerateData();
    }
}

Bind Blazor TreeList to Flat Data

Run Demo: Flat Data

Implements

See Also