Occurs before the tree node is expanded.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The following code example demonstrates how to change the collapse state of a TreeView so that all the checked nodes are visible. First, all the nodes are collapsed, and a handler is added for the event. Next, all the nodes are expanded. The event handler determines whether a given node has child nodes that are checked. If a node does not have checked children, the expansion is canceled for that node. In order to allow standard node expansion when the plus sign next to a node is clicked, the event handler is then removed.
This behavior can also be implemented by handling the BeforeCollapse event, as illustrated in the example for that topic.
For the complete example, see the CheckBoxes reference topic.
Available since 1.1