ComboBox class Core
A value picked from a list. Closed it shows the value and a chevron; open, the grid's own combo list (the one the filter and the editors open) hangs below it in the pane stack, over the whole board and never cut at the tile.
Picking only (the default): Down and Up pick the next and the previous value at once, Home and End the first and the last, typing jumps to the value it begins (type-ahead, the same letter again cycles); Alt+Down, F4, Enter and Space open the list, which then takes the keyboard until a pick or Esc.
ComboBox.IsEditable: a text field with suggestions. Typing filters the list of values that contain the text, open below while the text keeps the keyboard; Down and Up move through the suggestions, Enter takes the marked one, Esc closes the list. Caret, selection, the clipboard and the input method work as in a TextBox.
For assistive technology it is a combo box whose value is ComboBox.Value (set it to pick; typed in where it is editable) and that expands and collapses its list.
Styling. From the style sheets (Select.Type<ComboBox>()): background, border colour and width, corner radius, the text's colour, size and family, the accent colour (the open look and the caret) and the opacity, in the states hover, focus, pressed and disabled.
Change ComboBox.Items and ComboBox.Value on a shown board inside Board.Mutate. ComboBox.ValueChanged runs as part of the user's input, a pick from the open list included.
public sealed class ComboBox : Control
- Namespace
- ArionUI.Presentation.Controls
- Package
- ArionUI.Presentation ·
dotnet add package ArionUI.Presentation --prerelease - Inherits
- Control
Constructors
ComboBox
public ComboBox();An empty combo box.
Properties
AccessibleDescription
public override string? AccessibleDescription { get; }The secondary text of the value shown (a customer's number), for a reader.
AccessibleValue
public override string? AccessibleValue { get; }The text of a text part; null when the part carries no value.
CaretRect
public override LogRect? CaretRect { get; }Where the caret of a text sink stands, absolute like Control.Bounds and as last drawn; null for a control without a caret or before it was drawn. The host anchors the input method's candidate window here.
Cursor
public override GridCursor Cursor { get; }The pointer shape over this control: the arrow (GridCursor.Default) over buttons, options, tabs and everything else that is clicked, the I-beam (GridCursor.Text) over text that can be typed in, the hand only over a link - the Windows rule. A control with parts of different shapes answers Control.CursorAt.
DrawsOwnFocus
public override bool DrawsOwnFocus { get; }The control shows its focus itself (accent border, hover row, ring parameter). False = the host draws the shared default ring around Control.Bounds.
Focusable
public override bool Focusable { get; }Can this KIND of control hold the keyboard focus? Combined with the live probes in Control.CanTakeFocus.
Height
public double Height { get; init; }Desired height of the box; the width is whatever it is given.
IsEditable
public bool IsEditable { get; init; }A text field with suggestions instead of a pick from the list only.
IsOpen
public bool IsOpen { get; }Whether the list is open.
ItemLook
public Func<string, ComboItemLook>? ItemLook { get; init; }How a value reads, closed and in the list (ComboItemLook: an initials badge before it, a secondary text after it); null shows the value alone. A box that only picks shows it closed; an editable box shows its text as typed.
Items
public IReadOnlyList<string> Items { get; set; }The values to pick from. Setting it does not change ComboBox.Value.
Placeholder
public LocalText Placeholder { get; init; }Shown dimmed while there is no value.
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.
Spoken
public Func<string>? Spoken { get; init; }What a screen reader calls the box ("Country"); the value is read as its value. Null calls it by its value.
Value
public string Value { get; set; }The value shown; where it is editable, the text typed. Setting it neither opens the list nor raises ComboBox.ValueChanged. The value already shown changes nothing: where it is editable, caret and undo stay.
ValueChanged
public Action<string>? ValueChanged { get; init; }The value changed through the user: a pick, a step, typing.
WantsText
public override bool WantsText { get; }Typing reaches an editable box; one that only picks takes it for type-ahead while it holds the focus, and never draws typing meant for no field to itself.
WantsTick
public override bool WantsTick { get; }Lets a type-ahead prefix run out, on the frame time.
Methods
CursorAt
public override GridCursor CursorAt(LogPoint p);An editable box: the I-beam over its text, the arrow over the drop-down button. A box that only picks is a button: the arrow all over.
Invoke
public override bool Invoke();Expands or collapses the list, as the chevron does.
Measure
public override LogSize Measure(LogSize available);Desired size given the space available (layout containers sum this).
OnDetached
protected internal override void OnDetached();A box that is no longer shown closes its list: the pane would act on nothing.
OnFocusChanged
public override void OnFocusChanged();Focus arrived at or left this control (read Control.IsFocused). For side effects the host cannot know — a list syncing its hover row.
OnKey
public override bool OnKey(ArionKey key, ArionModifiers mods);Keys while focused. Return false to let the pane's fallback see the key.
OnPointerMoved
public override void OnPointerMoved(LogPoint p, bool buttonDown);
OnPointerPressed
public override void OnPointerPressed(LogPoint p, ArionModifiers mods, int clickCount);
OnPointerReleased
public override void OnPointerReleased(LogPoint p);
OnText
public override void OnText(string text);
Render
public override void Render(IRenderSurface s, ControlFrame frame);
SetAccessibleValue
public override bool SetAccessibleValue(string value);Types the value in where the box is editable; picks it where it is one of ComboBox.Items otherwise.
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.
Tick
public override void Tick(double dtMs);One frame of the animation. What it changes on screen it marks itself (Control.Invalidate): on a board only the marked area is drawn again.