DatePicker

Date input with field-by-field editing and calendar icon.

Overview

DatePicker extends Control and provides a structured date input with separate editable fields for year, month, and day. A calendar icon () is displayed alongside the fields to visually identify the control. When no date is selected, customizable placeholder text is shown. Users navigate between fields with Left/Right arrows or Tab, adjust values with Up/Down arrows, or type digits directly — the cursor auto-advances to the next field once enough digits are entered. The control validates dates automatically, clamping day values to the correct range for the selected month and year.

Basic Example

<StackPanel Orientation="Vertical">
  <TextBlock Text="Select a date:" />
  <DatePicker PlaceholderText="Pick a date..." />
</StackPanel>

Properties

PropertyTypeDefaultDescription
SelectedDateDateTime?nullThe currently selected date, or null if no date is chosen.
DateFormatstring"yyyy-MM-dd"Display format string controlling field order and separators.
Iconstring"\uF073"Nerd Font glyph displayed as the calendar icon.
PlaceholderTextstring"Select date..."Text shown when SelectedDate is null.
WidthSizeAutoExplicit width of the control.
HeightSizeAutoExplicit height of the control.
FocusColorColorCyanBorder color when the control has keyboard focus.
HoverColorColorYellowBorder color when the mouse hovers over the control.

Examples

Empty with Placeholder

<DatePicker PlaceholderText="No date selected" />

Pre-Set Date

<StackPanel Orientation="Vertical">
  <TextBlock Text="Start date:" />
  <DatePicker SelectedDate="2026-01-15"
              DateFormat="yyyy-MM-dd" />
</StackPanel>

Custom Icon

<StackPanel Orientation="Vertical">
  <TextBlock Text="Event date:" />
  <DatePicker SelectedDate="2026-12-25"
              Icon=""
              FocusColor="Magenta"
              DateFormat="yyyy-MM-dd" />
</StackPanel>

Keyboard Shortcuts

KeyAction
Left ArrowMove focus to the previous field (day → month → year).
Right ArrowMove focus to the next field (year → month → day).
TabAdvance to the next field, same as Right Arrow.
Up ArrowIncrement the focused field by one (year, month, or day).
Down ArrowDecrement the focused field by one (year, month, or day).
0–9Direct digit entry — auto-advances to the next field when the current field is full.

Key Concepts