TreeList.CollapseToLevel(Int32) Method

Collapses all nodes at the specified and subsequent levels.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v20.1.dll


public void CollapseToLevel(
    int level
Public Sub CollapseToLevel(
    level As Integer


Name Type Description
level Int32

A System.Int32 value that specifies the level starting from which nodes should be collapsed. 0 to collapse nodes starting from the root.


The TreeList displays data in a hierarchical structure using nodes (TreeListNode objects). The hierarchical level of a certain TreeListNode can be obtained with the TreeListNode.Level property. Nodes can be expanded to display nested nodes, and collapsed afterwards. To expand\collapse a particular node in code, use the TreeListNode.Expanded property.

The CollapseToLevel method collapses nodes starting from the specified level. For instance, calling the CollapseToLevel method with the level parameter set to 0, collapses all nodes.

See Also