Skip to main content

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.v23.2.dll

NuGet Packages: DevExpress.Win.Navigation, DevExpress.Win.TreeList

Declaration

[DefaultValue(0)]
public object RootValue { get; set; }

Property Value

Type Default Description
Object 0

An object the root nodes contain in the field specified by the TreeList.ParentFieldName property. By default, an integer 0 value.

Remarks

The KeyFieldName and 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, an Integer 0 value).

Important

The RootValue property and values in the KeyFieldName and ParentFieldName fields must be of the same type.

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.

The following code snippets (auto-collected from DevExpress Examples) contain references to the RootValue property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also