Bound Mode

  • 3 minutes to read

Online Video

Learn how to create a Tree List control, bind it to data, and customize the control's view and behavior options.

 

The Tree List control can be bound to any traditional data source: a BindingSource, BindingList<T>, List<T>, DataTable, DataView and DataSet objects, objects that implement specific interfaces (e.g., IList, ITypedList and IBindingList), SQL data, XML data, Excel data sources, etc. See this help topic for the complete list of available data sources: Data Binding Common Concepts.

As any other DevExpress data-aware control, Tree List shows data from its sources as is. If you need to filter or sort records, or merge multiple data sources into one, do that at the data source level before you bind a Tree List to this source.

Use the following properties to bind Tree List to data.

More information is provided below.

TreeList Control Binding Specifics

Like other data-aware controls, the Tree List control provides the traditional TreeList.DataSource and TreeList.DataMember properties for binding. Use the latter property if the TreeList.DataSource is a DataSet object (DataSets can contain multiple tables).

Due to the hierarchical structure of Tree List nodes, the bound data source must contain two fields to identify the relationship between records. Assign these two field names to the following properties:

Besides these two properties, you also need to specify the TreeList.RootValue property, which allows the Tree List control to determine root nodes. Data source records that have the RootValue in the ParentFieldName field will be regarded as root nodes. To learn more about the node hierarchy setting-up, see the following topic:

NOTE
  • Although Tree List allows you to display records from an underlying data source as a plain list (the TreeList.KeyFieldName and TreeList.ParentFieldName properties must be empty), we recommend using the Data Grid control for this task.
  • Dynamic data loading (virtual mode) is not supported in bound mode.
  • To sort data, do not use the methods provided by the bound data source. Instead, sort data using methods provided by the Tree List control. See Sorting to learn more.

 

 

The topics in the following section describe common data-binding concepts and scenarios that are applied to the Tree List, Data Grid, and other data-aware controls.

General Data Binding Concepts

See Also