TcxTreeListStyles.OnGetContentStyle Event
Allows you to apply different styles to data cells.
Declaration
property OnGetContentStyle: TcxTreeListGetContentStyleEvent read; write;
Remarks
The Content property defines the initial content cell style. ContentEven and ContentOdd properties allow you to specify different styles for even and odd nodes.
You can handle the OnGetContentStyle event to apply different styles to data cells based on custom conditions.
Event Occurrence
The OnGetContentStyle event occurs every time a Tree List control is about to redraw a data cell, for example, when data changes.
Event Parameters
You can use Sender, AColumn, and ANode parameters to identify the control that raised the OnGetContentStyle event and the target node. The AStyle parameter allows you to assign an existing style to the target node.
Refer to the TcxTreeListGetContentStyleEvent procedural type description for detailed information on parameters accessible within OnGetContentStyle and OnGetHotTrackStyle event handlers.
Code Example: Apply Different Styles to Ordinary and Group Nodes
The following code example applies two different styles to group and ordinary nodes:
procedure TMyForm.cxTreeList1GetContentStyle(Sender: TcxCustomTreeList; AColumn: TcxTreeListColumn;
ANode: TcxTreeListNode; var AStyle: TcxStyle);
begin
if ANode.IsGroupNode then
AStyle := CategoryStyle;
else
AStyle := TaskStyle;
end;