I want to augment VisualElements with custom data.
I expected that I could use some additional attributes in UXML.
However, I do not see an API to query non-standard attributes from UXML.
Is there no map with all attributes from UXML?
What I am looking for is the equivalent of Element.attributes
Motivation
I implemented some custom VisualElement navigation. Thereby, I want to be able to specify navigation targets manually via custom UXML attributes.
I use regular VisualElements (Button, TextField) and do not want to implement my own just for some additional attributes.
Wow, that’s a surprise! Would be easy to use and flexible enough for many use cases.
There seems to be one attribute userData but can this be set from UXML?
However, this is not a great solution because it is likely to conflict with other usages of the same field.
My idea was to use custom attributes like navigation-target-left, navigation-target-right etc.
Guess I have to think again…
The same could be done with UXML.
I think exposing a map of attributes would be a low hanging fruit, easy to implement but with great benefit for the user.