Skip to main content
All docs
V22.2

DevExpress v25.1 Update — Your Feedback Matters

Our What's New in v25.1 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

Example

#In this example we use the OnSetDisplayItemText event to change the text of tree nodes based on the tree node level. Tree nodes may display any text, but you will can only edit Text that is required from the field – ListField.

procedure TForm1.dxDBTreeViewSetDisplayItemText(Sender: TObject;
  var DisplayText: string);
Var
 tr : TTreeNode; 
begin
  // Get TreeNode
  tr := dxDBTreeView.DBTreeNodes.GetTreeNode(TreeQueryID.Value);
  if tr <> Nil then begin
    if tr.Level mod 2 = 1 then
      DisplayText := Field1.Text
    else DisplayText := Field2.Text;
  end;  
end;