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

Example: OnGetContentStyle

The following sample uses the OnGetContentStyle event. The event handler assigns a style to the current node depending on whether it is a group node.

Note that the sample requires an instance of the style repository. The repository should contain the following two styles: styCategory (which is used for group nodes) and styTask (used for the other nodes).

procedure <Form>.<TreeList>StylesGetContentStyle(Sender: TcxCustomTreeList; AColumn: TcxTreeListColumn; ANode: TcxTreeListNode; var AStyle: TcxStyle);
begin
  if ANode.IsGroupNode then
    AStyle := styCategory
  else
    AStyle := styTask;
end;