DatePicker.Date Property

Definition

Gets or sets the date currently set in the date picker.

public:
 property DateTime Date { DateTime get(); void set(DateTime value); };
DateTime Date();

void Date(DateTime value);
public System.DateTimeOffset Date { get; set; }
var dateTime = datePicker.date;
datePicker.date = dateTime;
Public Property Date As DateTimeOffset

Property Value

DateTimeOffset

The date currently set in the picker.

Remarks

The Date property can't be set as a XAML attribute string, because the Windows Runtime XAML parser doesn't have a conversion logic for converting strings to dates as DateTime / DateTimeOffset objects. Here are some suggested ways these objects can be defined in code and set to a date other than the current date.

Another possible technique is to define a date that's available as a data object or in the data context, then set Date as a XAML attribute that references a {Binding} markup extension that can access the date as data.

Applies to

See also