Skip to main content
A newer version of this page is available. .

TreeList.AfterCollapse Event

Fires immediately after a node has been collapsed.

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v19.2.dll

Declaration

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.

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.

Example

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;
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AfterCollapse event.

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.

See Also