Skip to content

StatePanelContext

Namespace: Hex1b

Assembly: Hex1b.dll

A context for building the child tree of a . Provides access to generic state storage scoped to the panel's identity.

csharp
public sealed class StatePanelContext : WidgetContext<StatePanelWidget>

Inheritance

Object → WidgetContext<StatePanelWidget> → StatePanelContext

Properties

Elapsed

Time elapsed since the last reconciliation frame for this panel. Subsystems can use this to advance time-based state (e.g. animations).

Returns: TimeSpan

csharp
public TimeSpan Elapsed { get; }

Methods

GetState<T>(Func<T>)

Gets or creates a state object of the specified type. The factory is called once on first access; subsequent calls return the same instance. State persists across reconciliation frames for the same state key.

Parameters:

  • factory (Func<<T>>): Factory invoked on first access to create the state object.

Returns: <T>

csharp
public T GetState<T>(Func<T> factory) where T : class

Remarks

This context is created during reconciliation (not during widget building), so the underlying node has already been resolved via identity matching. On first render, a new node is created.

Subsystems (e.g. animation) can store their state via . Re-render scheduling is automatic via the interface.

Released under the MIT License.