Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

TdxCustomTreeView.OnCollapsed Event

In This Article

Allows you to respond to node collapse operations.

#Declaration

Delphi
property OnCollapsed: TdxTreeViewNodeEvent read; write;

#Remarks

This event occurs every time a tree node is collapsed.

You can handle the OnCollapsing event to prevent users from collapsing specific nodes.

Note

You can handle the control’s OnExpanding and OnExpanded events to track node expand operations and customize their behavior.

The following OnCollapsed event handler changes an image of the collapsed node whose image index is 1 to an image with the index 2:

procedure TForm1.dxTreeViewControl1Collapsed(Sender: TdxCustomTreeView;
  ANode: TdxTreeViewNode);
begin
  if ANode.ImageIndex = 1 then
    ANode.ImageIndex := 2;
end;

Note

A tree node’s ExpandedImageIndex allows you to change the collapsed node image without an OnCollapsed event handler.

Refer to the TdxTreeViewNodeEvent type description for information on available options.

See Also