GridContext class Core

One grid's texts, icons, sort culture and module catalogues; GridContext.Default serves every grid without its own context and the static facades outside a grid's scope.

public sealed class GridContext
Namespace
ArionUI.Presentation
Package
ArionUI.Presentation · dotnet add package ArionUI.Presentation --prerelease

Remarks

GridContext.Current is a per-thread ambient like ArionTheme.Current: a grid stamps its context around every render, input and accessibility pass with GridContext.Use, so template code keeps reading the static facades. A scope is a ref struct and cannot span an await.

Constructors

GridContext

public GridContext();

Properties

ButtonPainter

public Action<IRenderSurface, LogRect, string, ButtonVisual, bool, bool> ButtonPainter { get; set; }

Draws every button of the grid (surface, rect, label, visual, hot, pressed); the keyboard focus ring is drawn over it regardless.

Culture

public CultureInfo? Culture { get; init; }

The culture the grid formats and parses numbers and dates with — cell text, editors, filters, calendar, chart axes; null means the thread's current culture. Stamped as FormatCulture.Current with every scope of this context, so two grids in one process can format in two languages.

Current

public static GridContext Current { get; }

The context of the grid currently rendering, hit-testing or announcing on this thread; GridContext.Default when no grid has stamped one.

Default

public static GridContext Default { get; }

The process-wide context: every grid without its own, and the static facades outside a grid's scope.

Icons

public ArionIcons Icons { get; set; }

The grid's chrome icons.

PanePainter

public Action<IRenderSurface, LogRect, double> PanePainter { get; set; }

Draws every pane card of the grid (surface, bounds, corner radius).

SortCulture

public CultureInfo? SortCulture { get; init; }

The culture text is sorted, grouped and listed by; null means the process-wide SortFilterSource.SortCulture. Fixed at construction because a grid applies it when the context is assigned.

Texts

public ArionTexts Texts { get; set; }

The grid's user-visible strings.

Methods

Get

public T Get<T>() where T : class, new();

The catalogue of a module (a Pro module's texts, for example), created on first access. Modules keep their static facades and resolve through here.

Set

public void Set<T>(T value) where T : class;

Replaces a module catalogue wholesale.

Use

public static GridContext.ContextScope Use(GridContext context);

Makes context the ambient one for the current synchronous operation. Nested scopes restore their caller's context, also when the operation throws.

Nested types

GridContext.ContextScope struct