UiRenderer

  • Namespace: Turian.Engine.UI
  • Source File: UiRenderer.Bindings.cs, UiRenderer.cs, UiRenderer.Controls.cs

Properties

Handlers

(IDictionary<string, Action>) = new Dictionary<string, Action>(StringComparer.Ordinal): Event handlers by method name, invoked when a matching element event fires.

ImageResolver

(Func<string, SKImage?>?) { get; set }: Resolves an image src (path or asset://) to an image, or null.

FontResolver

(Func<string, Font?>?) { get; set }: Resolves a font reference (path, asset:// or family name) to a base font, or null.

DataResolver

(Func<string, object?>?) { get; set }: Resolves a binding path to a value. Set directly, or via Bind.

TextResolver

(Func<string?, string?, string>?) { get; set }: Localizes an element's text: (key, source) where key is an explicit text-key attribute or null, and source is the authored text (or bound value) that doubles as the lookup key when no explicit key names one. Called for labels, button text, toggles, tab headers and field placeholders.

StyleSheets

(IList) = new List<StyleSheet>(): .uss stylesheets to apply, lowest priority first. Populated from the document's &lt;Style&gt; references by whoever loads it.

Public Methods

Bind

public void Bind(object? dataContext = null, UiController? controller = null)

Wires a data context and/or a UiController: bindings resolve against dataContext (defaults to controller), events call the controller's public parameterless methods, and any &lt;Bindings&gt; entries are folded onto their target elements.

Parameters:

  • dataContext (object?): Object binding paths resolve against, or null to use the controller. (Default: null)
  • controller (UiController?): Code-behind whose public methods become event handlers. (Default: null)

Render

public void Render(Gui gui)

Renders one frame of the document into gui.

Parameters:

  • gui (Gui): The Guinevere context for the current pass.