This topic demonstrates how to use the SmartTreeView SmartControl using both the designer and code. The code is provided in a sequential order and can be cut and pasted into your application step-by-step.
To use the SmartTreeView in your application, the following steps must be performed:
Add the SmartTreeView control to your form.
If you would prefer to add the SmartTreeView SmartControl to your form programmatically, the following code can be used:
Double click on the New Node menu or click on the drop down arrow to add the desired number of Node SmartItems.
If you want to add items other than Nodes, you can click on the drop down arrow and select the SmartItem to add.
To add SmartItems programmatically to the SmartTreeView, you can use the following code:
The first four items to be added will be the default item (in this case the Node SmartItem is both the default and the only preferred SmartItem), however the last item to be added is a SmartExplorerTaskPane Task SmartItem.
Configure your SmartTreeView. You can decide if a Node SmartItem is expanded, enabled or visible and you can change its text, position within the list, etc.
In the following code, we will move the last SmartItem (Task) to the first position:
When you run your application, you end up with an XP-style checked treeview quite similar to the one found throughout Windows: