Fires before a node is expanded. Allows you to implement dynamic node loading in unbound mode.
public event BeforeExpandEventHandler BeforeExpand
Public Event BeforeExpand As BeforeExpandEventHandler
The BeforeExpand event's data class is BeforeExpandEventArgs. The following properties provide information specific to this event:
|CanExpand||Gets or sets whether a Tree List node can be expanded.|
|Node||Gets the current Tree List node. Inherited from NodeEventArgs.|
Nodes that have child nodes can be expanded/collapsed to show/hide their children. You can use the TreeListNode.Expanded property of a node to control its state. The TreeList.ExpandAll, TreeList.ExpandToLevel and TreeListNode.ExpandAll methods also make use of this property to perform their task.
When a node is about to be expanded, the BeforeExpand event fires.
The BeforeExpand event also fires when expanding a node that does not have child nodes, provided that its TreeListNode.HasChildren property is set to true. Use the HasChildren property and BeforeExpand event to implement dynamic node loading in unbound mode. This load mode implies that only root-level nodes are initially created. Child nodes are loaded dynamically when their parent node is about to be expanded (using the BeforeExpand event). Please refer to the How to: Implement Virtual Mode (Dynamic Loading) in Unbound Mode topic, for an example.
You can also use the BeforeExpand event to specify whether the processed node is allowed to be expanded. The BeforeExpandEventArgs.CanExpand event's parameter must be used for this purpose.
If your aim is to perform specific actions each time a node has been expanded, consider using the TreeList.AfterExpand event.