UiDocument

A parsed .ui document: an ordered list of stylesheet references, named templates, the visual-element tree, and any explicit <Bindings>. Authored as XML; round-trips to JSON for tooling and for the baked import artifact.

Properties

ControllerType

(string?) : Fully-qualified UiController type from the root controller attribute, or null.

StyleSheets

(List) = []: src of each <Style>, in the order they should be applied.

Templates

(Dictionary<string, UiTemplate>) = []: Named &lt;Template&gt; sub-trees, keyed by name.

Root

(UiElement) = new(): The root visual element (the single child of &lt;UI&gt;).

Bindings

(List) = []: Bindings collected from every &lt;Bindings&gt; block, flattened.

SourcePath

(string?) : Project-relative path the document was loaded from, for diagnostics. Optional.

Public Methods

ToJson

public string ToJson()

Serializes the document to JSON (used by tooling and the baked import artifact).

Returns: string

FromJson

public static UiDocument FromJson(string json)

Rebuilds a document from JSON produced by ToJson.

Parameters:

  • json (string): JSON text.

Returns: UiDocument

Find

public UiElement? Find(string name)

Finds the first element in the tree with the given name.

Parameters:

  • name (string): The element name.

Returns: UiElement?

Elements

public IEnumerable<UiElement> Elements()

Every element in the tree, depth-first.

Returns: IEnumerable<UiElement>