Skip to main content
All docs
V26.1
  • DxTreeViewDataMappingBase.Expanded Property

    Maps a data source field that specifies whether a TreeView node is expanded.

    Namespace: DevExpress.Blazor.Base

    Assembly: DevExpress.Blazor.v26.1.dll

    Declaration

    [DefaultValue(null)]
    [Parameter]
    public string Expanded { get; set; }

    Property Value

    Type Default Description
    String null

    The field name.

    Remarks

    The Expanded property maps a Boolean field from your data source to the expanded state of TreeView nodes. When the field value is true, the corresponding node is expanded. Otherwise, the node is collapsed.

    The following code snippet maps the IsExpanded field to the initial expanded state of a TreeView node:

    <DxTreeView Data="@Departments">
        <DataMappings>
            <DxTreeViewDataMapping Children="Children"
                                   Text="Name"
                                   Expanded="IsExpanded" />
        </DataMappings>
    </DxTreeView>
    
    @code {
        List<Department> Departments = new List<Department> {
            new Department {
                Name = "Engineering",
                IsExpanded = true,
                Children = new List<Department> {
                    new Department { Name = "Frontend" },
                    new Department { Name = "Backend" }
                }
            },
            new Department {
                Name = "Marketing",
                Children = new List<Department> {
                    new Department { Name = "Digital" },
                    new Department { Name = "Content" }
                }
            }
        };
    }
    

    When a user expands or collapses a TreeView node, the component does not update the mapped field in your data source. Handle the following TreeView events to update the data source programmatically:

    See Also