DatePicker class Core
A date field with a calendar, the free-standing form of a grid's date editor: typed through a mask made from the culture's short date (DatePatterns.NumericShortDate: "__.__.____" in German, "__/__/____" in US English), read back with the date column's rule (DateText: the format first), or picked in the grid's calendar (the button, Alt+Down or F4). Up and Down step the part of the date the caret stands in - day, month or year - as in a date cell. Like NumericUpDown it holds no value of its own: DatePicker.Value reads it and DatePicker.Changed hands a new one over.
Typed text is taken on Enter or when the keyboard leaves; a text that is no date keeps the field TileStates.Invalid with the date column's message until it is corrected or Escape restores the value. An empty field clears the value when DatePicker.AllowsEmpty.
The calendar opens in the pane stack of the grid that shows the board, or in the pane stack of the ArionControlSurface it is on.
Styling. From the style sheets (Select.Type<DatePicker>()): as a NumericUpDown; the accent colours the button while the calendar is open.
public sealed class DatePicker : Control
- Namespace
- ArionUI.Presentation.Controls
- Package
- ArionUI.Presentation ·
dotnet add package ArionUI.Presentation --prerelease - Inherits
- Control
Constructors
DatePicker
public DatePicker();A field in the theme's body text.
Properties
AccessibleValue
public override string? AccessibleValue { get; }The text of a text part; null when the part carries no value.
AllowsEmpty
public bool AllowsEmpty { get; init; }Whether clearing the field clears the date (true) or restores it.
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.
Changed
public required Action<DateTime?> Changed { get; init; }Called with the new date when the user changes it (never with the date it already has); store it where DatePicker.Value reads it.
Culture
public CultureInfo? Culture { get; init; }The culture of the format and of reading typed text; null takes the grid's (or the thread's) culture when it is used.
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.
Format
public string? Format { get; init; }The .NET format the date is shown and typed in; null takes the culture's short date with two-digit day and month when it is used.
Height
public double Height { get; init; }Desired height; the width is whatever it is given.
IsOpen
public bool IsOpen { get; }Whether the calendar this field opened is on screen.
Maximum
public DateTime? Maximum { get; init; }The latest date that may be set; null for no limit.
Minimum
public DateTime? Minimum { get; init; }The earliest date that may be set; null for no limit.
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; }The field's name for a screen reader ("Start date").
Text
public string Text { get; }The text as the field shows it now: what is typed, or the date.
Today
public Func<DateTime>? Today { get; init; }What the calendar calls today; null is the machine's date.
Value
public required Func<DateTime?> Value { get; init; }The current date (null: none), asked each time it is drawn.
WantsText
public override bool WantsText { get; }Is this control a text sink? The host routes typing to the focused text control, or — the Excel rule — jumps to the FIRST one in the tree.
Methods
CursorAt
public override GridCursor CursorAt(LogPoint p);The I-beam over the date, the arrow over the calendar button (and the mark of an invalid value).
Invoke
public override bool Invoke();Opens the calendar, as the button 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 field that is no longer shown closes its calendar.
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.
OnPointerLeft
public override void OnPointerLeft();The pointer stopped hovering this control (moved on or left the pane).
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);Sets the date a screen reader typed, read as typed text is. False when disabled or not a date.
SpokenLabel
public override string? SpokenLabel();The name and the date written out ("Start date, Monday, 6 October 2026").