FormGrid class Core

A form laid out as one grid: a column of labels and a column of fields beside them, each field with its FieldNote right under it, and rows that span both columns (an action row, a heading). Every field starts at the same edge, a check box and a switch included, so nothing stands indented by chance; a label stands level with the first line of its field. Narrower than FormGrid.StackWidth the form stacks: each label over its field, every field as wide as the form. A row whose field is hidden is gone, its label and note with it.

Styling. The labels are Labels with the class form-label (the theme draws them dim); fields and notes keep their own looks.

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

Constructors

FormGrid

public FormGrid();

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.

ColumnGap

public double ColumnGap { get; init; }

The space between the label column and the field column.

FirstLineHeight

public double FirstLineHeight { get; init; }

The height up to which a field is one line: its label stands centred beside the whole field. A taller field (a text area, a list) has its label centred on its first line of this height.

LabelWidth

public double LabelWidth { get; init; }

The width of the label column; NaN (the default) makes it as wide as the widest label shown, so the fields take the rest of the form's width.

NoteGap

public double NoteGap { get; init; }

The space between a field and its note.

RowGap

public double RowGap { get; init; }

The space between two rows.

StackWidth

public double StackWidth { get; init; }

Below this width each label stands over its field instead of beside it.

Methods

Add

public FormGrid Add(Func<string> label, Control field, FieldNote? note = null, double height = double.NaN);

Adds a field with its label (and, under the field, its note) as the next row.

Parameters

label

The label, asked each time it is drawn.

field

The field.

note

The note under the field; null for none.

height

The field's height; NaN (the default) takes what it measures.

AddWide

public FormGrid AddWide(Control content, TileAlign align = default, double height = double.NaN);

Adds a row across both columns: an action row (align TileAlign.End puts it at the right), a heading, a separator.

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).

Render

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