FieldNote class Core

The line under an input field that says what the field needs: its error while the value does not validate - the field's own Control.ValidationMessage, with the same mark the field carries - else a hint; and, below it, a meter that sets the value against a limit (a stock level as a bar and "120 in stock"), red while the field is in error. One note for every kind of input, so a form shows its errors in one way, and the field then marks its error with its frame alone. The message is there while the note has a hint or the field an error, wrapped to the note's width, never cut; the board around it makes room when that changes.

Styling. From the style sheets (Select.Type<FieldNote>()): the hint's colour (foreground), the error's colour (accent colour), the text size and family; the meter is a ProgressBar, with the class danger while the field is in error.

public sealed class FieldNote : Control
Namespace
ArionUI.Presentation.Controls
Package
ArionUI.Presentation · dotnet add package ArionUI.Presentation --prerelease
Inherits
Control

Constructors

FieldNote

public FieldNote(Control field);

A note for field.

Properties

Children

public override IEnumerable<Control> Children { get; }

The controls inside this one, in tree order (visual order, tab order). A host keeps the tree it adopted: a control whose children change once it is adopted says so with Control.TreeChanged (on a shown board inside Board.Mutate), or its new children get no host and Tab, ticks and the wheel do not find them.

Field

public Control Field { get; }

The field the note is about.

Hint

public Func<string?>? Hint { get; init; }

What the field needs while it is valid ("Calculated once the quantity is valid"); null or empty for nothing.

Meter

public Func<double>? Meter { get; init; }

The fraction of the limit the value takes, 0 to 1 (shown as a bar); null for no meter.

MeterText

public Func<string?>? MeterText { get; init; }

The text beside the meter ("120 in stock"); null for none.

Role

public override ControlRole Role { get; }

What KIND of part this is for assistive technology — the automation peers translate it into their host's control type.

Methods

Arrange

public override void Arrange(LogRect bounds);

HitTest

public override Control? HitTest(LogPoint p);

The control under an ABSOLUTE point, or null. Containers recurse; leaves answer for themselves. Same bounds the render pass used.

Measure

public override LogSize Measure(LogSize available);

Desired size given the space available (layout containers sum this).

OnAttached

protected internal override void OnAttached();

A host shows the tree this control is in: it joined a shown board, or the board's view was attached. UI thread, under the render gate; the render pass may be running on the UI thread, so ask for frames here (Control.RequestTick), not for a repaint.

OnDetached

protected internal override void OnDetached();

The control is no longer shown: it left the tree, or the host let the tree go. Release what only a shown control needs - GPU resources, subscriptions.

Render

public override void Render(IRenderSurface s, ControlFrame frame);

SpokenLabel

public override string? SpokenLabel();

What a screen reader speaks when this control receives the focus. A control that cannot take the focus but answers here is READ: it becomes a text part.