System.Windows.Forms.TreeView.CollapseAll Method

Collapses all the tree nodes.

Syntax

public void CollapseAll ()

Remarks

The TreeView.CollapseAll method collapses all the System.Windows.Forms.TreeNode objects, which includes all the child tree nodes, that are in the System.Windows.Forms.TreeView control.

Note:

The state of a System.Windows.Forms.TreeNode persists. For example, suppose that you call the TreeNode.Expand method for a root tree node. If the child tree nodes were not previously collapsed, they will appear in their previously-expanded state. Calling the TreeView.CollapseAll method ensures that all the tree nodes appear in the collapsed state.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0