TreeList.RootValue Property

Gets or sets the value that identifies root records in the data source. The root records must have the RootValue in the field the ParentFieldName property specifies.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v20.1.dll

Declaration

[DefaultValue(0)]
public object RootValue { get; set; }
<DefaultValue(0)>
Public Property RootValue As Object

Property Value

Type Default Description
Object

0

An object the root nodes contain in the field specified by the TreeList.ParentFieldName property.

Remarks

The KeyFieldName and TreeList.ParentFieldName properties specify Key and Parent fields in the bound data source. The Tree List control uses these fields to organize the underlying records into a data hierarchy.

Root nodes must have their Parent Field values set to RootValue (by default, 0).

NOTE

Parent field values are compared to key field values using the Equals method. Note that this method returns different values for different data types, even if the values are the same. For instance, this method returns false if two compared values are the same, but represented by the double and decimal types. So, be sure that the field specified by the TreeList.ParentFieldName property is of the same type as the RootValue property. Otherwise, the tree will be reconstructed each time node values are changed. This may lead to a performance drop, as it causes the focused node and column to be reset, and changes the node order.

See Tree Generation Algorithm in the Tree List to learn more.

See Also