I know that we can use HTML to show custom Node text.
But how do I change the foreground color on a selected node. I tried several css pseudo selectors but with no luck.
Thank you
Daniel
Thanks for the sample. If it helps, the mixin from your sample does work to turn node text red when selected- as long as the HTML isn’t affecting the text color.
For example, if you use HTML to underline the text, your mixin will turn it red on hover:
treeView1.Nodes.Add(new TreeNode("<span style= \"text-decoration: underline\">Node 1</span>") {AllowHtml = true});
I tried this before.
This approach only works for normal nodes (without html).
Please see my example.
If you are using the ThemeBuilder to edit your themes, you will notice that under “Tree Node” there is an option for “textColor” under “selected”
The JSON for it would look something like this:
"tree-folder": {
"text": "Tree Node",
"components": {
"states": {
"default": {
"properties": {
"textColor": "",
"indent": 18,
"icon": "icon-folder",
"opacity": 1,
"padding": [2, 0, 2, 0]
},
"styles": {
"backgroundColor": null
}
},
"hovered": {
"styles": {
"backgroundColor": "hotTrack"
},
"properties": {
"cursor": "pointer"
}
},
"selected": {
"properties": {
"textColor": "YOURCOLORHERE"
},
"styles": {
"backgroundColor": "highlight"
}
},
Hi Daniel,
You can create a custom Theme, or write a Theme Mixin.
A Mixin basically overwrites the appearance on any Theme you choose, and it would make sense to use it for your use case since you’re going to target a single control.
For more information, please check out our documentation https://docs.wisej.com/theme-builder/getting-started/edit-a-mixin
Best,
Alaa