Gets or sets a value indicating whether check boxes are displayed next to the tree nodes in the tree view control.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
A check box is displayed to the left of both the tree node label and tree node Image, if any. Check boxes allow the user to select more than one tree node at a time.
When the TreeView is set to true, and the StateImageList property is set, each TreeNode that is contained in the TreeView displays the first and second images from the StateImageList to indicate an unchecked or checked state, respectively. However, the displayed images may be different if the following situation occurs: If the SelectedImageIndex of the node is set to a value other than 0 or 1, and the property of the parent TreeView is set to false, the SelectedImageIndex will not automatically reset to -1 to indicate it is not set. In this case, the state image at the indicated index position is shown. If is set to true again, the first and second images of the StateImageList are shown to indicate a checked or unchecked state, respectively.property of a
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 BeforeExpand event. Next, all the nodes are expanded. The BeforeExpand 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 BeforeExpand event handler is then removed.
This behavior can also be implemented by handling the BeforeCollapse event, as illustrated in the example for that topic.
Available since 1.1