Skip to main content

TreeList.AfterCollapse Event

Fires immediately after a node has been collapsed.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v22.2.dll

NuGet Package: DevExpress.Win.TreeList


public event NodeEventHandler AfterCollapse

Event Data

The AfterCollapse event's data class is NodeEventArgs. The following properties provide information specific to this event:

Property Description
Node Gets the current Tree List node.


Nodes can be expanded/collapsed to show/hide their child nodes. End-users can perform this by clicking a group button or double-clicking the corresponding indicator cell or using the PLUS/MINUS or CTRL + arrow keys when a particular node is focused. This can also be performed in code by changing the node’s TreeListNode.Expanded property value. In both cases, if a node has been collapsed, the AfterCollapse event fires.


the AfterCollapse event fires for nodes being collapsed when calling the TreeList.CollapseAll or TreeList.CollapseToLevel method.


The following sample code changes state images of parent nodes when they are expanded or collapsed. The TreeList.AfterExpand and TreeList.AfterCollapse events are handled for this purpose.

private void treeList1_AfterCollapse(object sender, DevExpress.XtraTreeList.NodeEventArgs e) {
   e.Node.StateImageIndex = 0;

private void treeList1_AfterExpand(object sender, DevExpress.XtraTreeList.NodeEventArgs e) {
   e.Node.StateImageIndex = 1;
See Also