The C1TreeNode class provides the Expand method to expand a single node (parent or child). The Expand method accepts Boolean values to determine whether the child nodes within a particular node should expand or not. On setting this method to true, all the child nodes along with the selected node gets expanded. If set to false, only the node at which the method is called gets expanded. The following code snippet demonstrates how to expand a single node using the Expand method.
The parent node gets expanded without expanding the child nodes, as shown below.
The C1TreeNode class also provides the Expanded property to expand a single node at a time.
Additionally, the C1TreeView class provides the ExpandAll method to fully expand a TreeView. In fully expanded state, the TreeView displays all the children nodes under a parent node as shown in the image below.
The following code snippet demonstrates how to fully expand a TreeView using the ExpandAll method.
Once the TreeView is in fully expanded state, you can prevent it from collapsing. This can be achieved by cancelling the Collapsing event of the C1TreeView class as demonstrated in the code below.
The C1TreeView class provides the CollapseAll method to fully collapse a TreeView. To collapse a single node (parent or child), the C1TreeNode class provides the Collapse method. This method accepts Boolean values to determine whether the child nodes within a particular node should collapse or not. On setting this method to true, all the child nodes along with the selected node gets collapsed. If set to false, only the node at which the method is called gets collapsed.