public sealed class DatePickerA field showing a date, with a calendar behind it.
Remarks
The second half of doc 49 § 7.1's rank 5. A Select whose list is a Calendar: the same field, the same chevron, the same popover hung off the document root so no scrolling ancestor clips it, and the same combobox role with Owns pointing at a popup that is nowhere near it in the element tree.
⚠ The keyboard goes into the calendar when it opens, which is where this parts company with Select. A select keeps the focus on its field and points at the current option with aria-activedescendant, because its options are a list the arrows walk. A calendar is a grid a user walks in four directions and pages through, and ARIA's date-picker pattern puts the focus on the day. Escape, a click outside and a choice all close it and give the keyboard back to the field.
⚠ It validates, so a Form asks it. Required and a date outside Minimum..Maximum — which a bound model can supply, even though the calendar will not offer one — both make it refuse a submission.
What it deliberately is not. The field cannot be typed into: a date is chosen from the calendar, or set by code. Typing a date is a parser per locale and a mask, and a field that half-parsed a date would be worse than one that shows it.
Fields and properties (21)
protected override string TagNameThe element name this type answers to when a caller does not choose one.
protected override AccessibleRole NativeRoleThe role this kind of element has when nobody says otherwise.
protected override string? NativeAccessibleValueprotected override AccessibleStates NativeAccessibleStatepublic UiElement FieldWhere the date is written.
public Icon ChevronThe chevron on the right of the field.
public Popover PopupThe floating panel the calendar is in.
public Calendar CalendarThe calendar in it.
public bool IsOpenWhether the calendar is showing.
public DateOnly? Valuepublic DateOnly? Minimumpublic DateOnly? Maximumpublic bool Requiredpublic string? Placeholderpublic CultureInfo? CultureWhich locale the date is written in and the calendar is laid out in. null is invariant.
public bool IsValidWhether the date held is acceptable: present if it is required, and inside the limits.
public static readonly UiPropertyKey ValuePropertyIdentity for Value.
public static readonly UiPropertyKey MinimumPropertyIdentity for Minimum.
public static readonly UiPropertyKey MaximumPropertyIdentity for Maximum.
public static readonly UiPropertyKey RequiredPropertyIdentity for Required.
public static readonly UiPropertyKey PlaceholderPropertyIdentity for Placeholder.
Events (1)
public Action<DatePicker, DateOnly?>? ValueChangedRaised when the chosen date changes.
Methods (10)
protected override void OnCreated()Builds whatever this element is made of, once, as it joins a document.
protected override void OnRemoved()public void Open()Shows the calendar and puts the keyboard on its chosen day, or on today.
public void Close(CloseReason reason = Code)Hides the calendar.
public void Revalidate()Republishes the verdict.
public void ClearValue()Unsets Value, so it takes its default or its ancestor's value again.
public void ClearMinimum()Unsets Minimum, so it takes its default or its ancestor's value again.
public void ClearMaximum()Unsets Maximum, so it takes its default or its ancestor's value again.
public void ClearRequired()Unsets Required, so it takes its default or its ancestor's value again.
public void ClearPlaceholder()Unsets Placeholder, so it takes its default or its ancestor's value again.
Used by (3)
- GalleryHelloUi
- DatePickerTestsVixen.Ui.Controls.Tests
- FieldFillTestsVixen.Ui.Controls.Tests