TreeList.AfterExpand Event
Fires immediately after a node has been expanded.
Namespace: DevExpress.XtraTreeList
Assembly: DevExpress.XtraTreeList.v24.2.dll
Declaration
Event Data
The AfterExpand 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
Each node within the Tree List control can have a number of child nodes. Child nodes can be hidden and made visible by collapsing or expanding their parent nodes respectively. Nodes can be expanded and collapsed in the following ways:
- An end-user clicks an expand button or double-clicks an indicator cell.
- The PLUS/MINUS key is pressed when the node is focused.
- The node is expanded in code using the TreeListNode.Expanded property or the TreeList.ExpandAll, TreeList.ExpandToLevel or TreeListNode.ExpandAll methods.
In all cases, the AfterExpand event fires immediately after expanding the node.
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;
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AfterExpand 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.