DatePicker
control allows the user to pick a date value.DatePicker
to let a user enter a date value. The user picks the date using ComboBox selection for month, day, and year values. You can customize the DatePicker
in various ways to suit your app.false
. For more info, see the DayVisible
, MonthVisible
, and YearVisible
properties.ComboBox
in the DatePicker
is created by a DateTimeFormatter
. You can use a string that is either a format template or a format pattern to specify the format. For more info, see the DayFormat
, MonthFormat
, and YearFormat
properties.Date
/ DateChanged
and SelectedDate
/ SelectedDateChanged
APIs. The difference between these is that Date
is not nullable, while SelectedDate
is nullable.SelectedDate
is used to populate the date picker and is null
by default. If SelectedDate
is null
, the Date
property is set to 12/31/1600; otherwise, the Date
value is synchronized with the SelectedDate
value. When SelectedDate
is null
, the picker is 'unset' and shows the field names instead of a date.SelectedDate
property, or handle the SelectedDateChanged
event.MinYear
and MaxYear
properties to restrict the date values in the picker. By default, MinYear
is set to 100 years prior to the current date and MaxYear
is set to 100 years past the current date.MinYear
or MaxYear
, you need to ensure that a valid date range is created by the date you set and the default value of the other date; otherwise, no date will be available to select in the picker. For example, setting only yearDatePicker.MaxYear = new DateTimeOffset(new DateTime(900, 1, 1));
creates an invalid date range with the default value of MinYear
.