TAdvTreeView - VCL Themes

It would appear that the AdvTreeView does not (yet) fully support VCL Themes. Turning AdaptToStyle on helps with the basic background but none of the Font colors are set to match the VCL Theme. I have got a reasonable approximation of the VCL Theme with these settings:

with AdvTreeView1.NodesAppearance do
	Font.Color := StyleServices.GetStyleFontColor(sfTreeItemTextNormal);
	DisabledFontColor := StyleServices.GetStyleFontColor(sfTreeItemTextDisabled);
	SelectedFontColor := StyleServices.GetStyleFontColor(sfTreeItemTextSelected);

	ExtendedFill.Color := StyleServices.GetStyleColor(scGenericGradientBase);
	ExtendedFill.ColorTo := StyleServices.GetStyleColor(scGenericGradientEnd);
	ExtendedFill.Kind := gfkGradient;
	ExtendedFontColor := StyleServices.GetStyleFontColor(sfPanelTextNormal);

However it is still far from perfect. So....

  • Are there any plans to improve the VCL Theme support in AdvTreeView?
  • Are there any tricks or better methods to improve the appearance of the AdvTreeView when using VCL Themes?


Which theme are you targeting? We tried to create a system where to mimic VCL style as best as possible but not all elements can be retrieved or found while parsing the style, this also depends on the chose style. We can improve the style support in AdvTreeView when we know which style is chosen.

I tried Cobalt XEMedia and Charcoal Dark Slate but I think any dark theme will have the same problems. These versions of the TreeView demos show with & without my modifications.


It seems that when setting AdaptToStyle at designtime before changing the style, the treeview does not properly adopt style changes. I suggest to programmatically set AdaptToStyle to true in the FormShow to workaround this issue. When doing so, you'll get the result below (tested with Cobalt XEMedia)

procedure TForm1.FormShow(Sender: TObject);
  AdvTreeView1.AdaptToStyle := True;

1 Like

Thanks, I will try that.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.