I need some help on what the convention is to reference things that I’ve loaded from XML, then added as a VisualElement. I’m trying to add some items to a node.
CloneTree returns a VE, but CloneTree(parent) doesn’t, so I can’t access the thing I added without a query? Also, visualElement.Add doesn’t return the VE you’re adding, either.
To me it should be as easy as this:
VisualElement node = nodeContainerXML.CloneTree(mainVE); // Can't because it returns void
VisualElement item = nodeItemXML.CloneTree(node);
VisualElement item2 = nodeItemXML.CloneTree(node);
VisualElement item3 = nodeItemXML.CloneTree(node);
item.style.backgroundColor....red
item2.style.backgroundColor....green
item3.style.backgroundColor....blue
I don’t see how I reliably find anything with a query unless it has a unique class added to it.
Also, how do I format a query for an element with multiple classes:
class="class1 class2 class3"
We really need a CloneTree() that returns a VisualElement that doesn’t parent it to a TemplateContainer…And CloneTree(VisualElement ve) that returns the VE.