Hi
I have an UltraTree which displays some data. I want to change the BackColor of some nodes according to its value.
I can do it "statically" in the InitializeDataNode event like this:
void tree_InitializeDataNode(object sender, Infragistics.Win.UltraWinTree.InitializeDataNodeEventArgs e){ SomeDataClass data = (SomeDataClass)e.Node.ListObject; if(data.IntProperty>100) { e.Node.Override.NodeAppearance.BackColor=Color.Red; }}
I would like to know if there's a way to load a styleset for the node so I can have a StyleLibrary with an "OverLimitNode" StyleSet and have it applied to this nodes.
The UltraTree has a StyleSetName property but i couldn't find this on the UltraTreeNode. There's only StyleLibraryName and StyleResourceName in the Override.NodeAppearance property of the node.
Thanks in advance!
StyleLibraryName has to do with Application Styling and it's only available on the control level, not for any individual parts of a control.
So you pretty much need to do what you are doing. You can, however, make it a bit more efficient. By assigning the BackColor of the NodeAppearance, you force each individual node to create a new Appearance object. But since they are all using the same BackColor, you could just use one.
So you could declate a form-level Appearance variable and set it's BackColor to red, then set the NodeAppearance to this single Appearance object. It won't save you any code, but it will save you a lot of overhead.
Ok. Thanks for the answer. I will take your advice into account.