Back to Devexpress

TreeList.CollapseAll() Method

windowsforms-devexpress-dot-xtratreelist-dot-treelist-69c671b2.md

latest5.3 KB
Original Source

TreeList.CollapseAll() Method

Collapses all the nodes in the Tree List.

Namespace : DevExpress.XtraTreeList

Assembly : DevExpress.XtraTreeList.v25.2.dll

NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.TreeList

Declaration

csharp
public virtual void CollapseAll()
vb
Public Overridable Sub CollapseAll

Remarks

Use the methods below to expand and collapse tree list nodes.

The control’s BeforeExpand, AfterExpand, BeforeCollapse, and AfterCollapse events fire during expand and collapse operations. For example, you can handle the BeforeExpand event to dynamically create child nodes in unbound mode.

Example

The code below collapses all tree list nodes.

csharp
treeList1.CollapseAll();
vb
TreeList1.CollapseAll()

The following code snippets (auto-collected from DevExpress Examples) contain references to the CollapseAll() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-treelist-save-restore-expanded-state-of-nodes/CS/TreeListViewState.cs#L42

csharp
try {
    TreeList.CollapseAll();
    TreeListNode node;

winforms-richedit-document-api/CS/RichEditAPISample/Form1.cs#L379

csharp
ShowFirstExample("Range");
    treeList1.CollapseAll();
}

winforms-treelist-save-restore-expanded-state-of-nodes/VB/TreeListViewState.vb#L46

vb
Try
    TreeList.CollapseAll()
    Dim node As TreeListNode

winforms-richedit-document-api/VB/RichEditAPISample/Form1.vb#L385

vb
ShowFirstExample("Range")
    treeList1.CollapseAll()
End Sub

See Also

Expanded

ExpandAll()

ExpandToLevel(Int32)

CollapseToLevel(Int32)

TreeList Class

TreeList Members

DevExpress.XtraTreeList Namespace