Restricts a VisualElementComponentAttribute component to a specific VisualElement
subclass (or any class derived from it). When present, every [RegisterCallback] static method
on the component may declare its owner parameter as the constrained type instead of plain
VisualElement, and the component picker filters by the constraint.
The constraint is validated cheapest-first: a Roslyn analyzer on statically-known
AddComponent<T>() calls, generator validation of handler signatures, an
AddComponent<T>() runtime check, and a UXML import check. A struct may carry at most one
RequiresElementOfTypeAttribute, and RequiresElementOfTypeAttribute.ElementType must be
VisualElement or a subclass (anything else, including interfaces, is a compile-time
error, UITKSG034).
| Property | Description |
|---|---|
| ElementType | The VisualElement subclass a component of this type may attach to. |
| Constructor | Description |
|---|---|
| RequiresElementOfTypeAttribute | Initializes the attribute with the required owner element type. |