TreeList.AfterCollapse Event

Fires immediately after a node has been collapsed.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v20.1.dll

Declaration

public event NodeEventHandler AfterCollapse
Public Event AfterCollapse As NodeEventHandler

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.

Remarks

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.

NOTE

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

Examples

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