TreeListView.RootValue Property

Gets or sets the root value. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v20.1.dll

Declaration

public object RootValue { get; set; }
Public Property RootValue As Object

Property Value

Type Description
Object

An object that specifies the root value.

Remarks

NOTE

The data types of the RootValue and data source fields specified by the TreeListView.KeyFieldName and TreeListView.ParentFieldName properties must be the same.

Root nodes do not have parent nodes. The parent value of a root node does not point to a key value of any other node. Root nodes are contained within the TreeListView.Nodes collection.

Treelist Levels

Use the RootValue property to explicitly specify the root value (for instance, to build a tree from the specified hierarchy level). Once this property is specified (by default, it is set to null), the collection of root nodes contains only those nodes whose parent values equal the root value. Nodes whose parent values do not point to any other node are ignored, and not displayed within a tree.

The following example demonstrates how to modify the tree shown above to display data from the specified hierarchy level. To do this, the RootValue property is set to 1. Since the service fields store integer values, the type of the value assigned to this property, must also be integer.

<dxg:TreeListView Name="treeListView"
                    KeyFieldName="ID" ParentFieldName="ParentID">
    <dxg:TreeListView.RootValue>
        <sys:Int32>1</sys:Int32>
    </dxg:TreeListView.RootValue>
</dxg:TreeListView>

The image below shows the result.

treelist-rootvalue

NOTE

The RootValue property must be specified when binding to a self-referential data structure.

To learn more, see Nodes Overview.

See Also