Before You Begin
The WinTree™control can be used to represent hierarchical data in a tree like structure. In addition to the column support, it has the ability to bind to a data source. When bound to a data source, UltraTreeColumnSet and UltraTreeNodeColumn objects are automatically generated since the AutoGenerateColumnSets property is set to true by default.
What you will Accomplish
You will learn how to bind WinTree to the Customers and Orders table of the Northwind database.
Follow these Steps
From the Microsoft® Visual Studio® Toolbox, drag and drop an UltraTree onto your form.
In the WinTree control’s Properties window, select the DataSource property to display the drop-down list. In the drop-down list, click the “Add Project Data Source…” link.
The Data Source Configuration Wizard will appear. Select Database and click Next.
Click New Connection to configure the connection string. The Add Connection dialog appears.
Make sure you have Microsoft SQL Server (Sql Client) under Data Source. Set the server name to the server you are using, .\SQLEXPRESS in this case. Set the database to Northwind.
Click OK. You are returned to the Choose your Data Connection screen.
Click Next.
Expand the Tables node and select the checkboxes next to Customers and Orders Table. Click Finish.
In the WinTree control’s DataSource property window, drop-down the dialog, and expand the Other Data Sources section. A Northwind dataset will be listed with the Customers and Orders table. Select the Orders table associated with the dataset first, as this will represent the child table. Then select the Customers table which will represent the parent table. A dataset, BindingSource, and TableAdapter will be generated and added as components to your form.
Now the WinTree will display the columns that will be shown when it is rendered.
Save and run the application. You will see the WinTree control filled with data from the Customers table, and if you expand a node, the associating Orders table will be visible.