vcl-170046-expressquantumtreelist-feature-center-data-exchange-bind-to-a-data-source.md
To begin working with the TreeList control, consider an example for the TcxDBTreeList data-aware TreeList control (located on the DevExpress page).
If the TreeList control is a data-aware control, it can be populated by hierarchically organized data if the underlying dataset contains two fields that relate to each other as parent-child. These fields should be defined using the same type. A dataset containing these types of fields is called a self-referenced dataset. The following image shows the structure of the DEPARTMENTS.DB table which was created in Paradox ® format:
The ID and ParentID fields are related fields. To inform the data-aware TreeList control which fields in a dataset are responsible for building the tree structure in the control use the TcxDBTreeListDataController.KeyField and TcxDBTreeListDataController.ParentField properties. At design time in the Object Inspector , bind the TcxDBTreeListDataController.KeyField property to the ID field and the TcxDBTreeListDataController.ParentField property to the ParentID field, as demonstrated in the image below:
To create the tree structure in the control and populate it with data from the dataset, double-click the TreeList control to invoke the Component Editor. In this editor, click the Columns tab and then click the Create all fields button:
Alternatively, you can right-click the TreeList control and select the Create All Columns item from the context menu.
For details on how to set up a connection to the database using the BDE or ADO data service please refer to the Connecting to Data topic.
This is the result when the application runs: