Gets the text that is displayed by the DatePicker, or sets the selected date.
Assembly: System.Windows.Controls (in System.Windows.Controls.dll)
Dependency property identifier field: TextProperty
A user can set the SelectedDate of a DatePicker by typing a date into its text box. The DatePicker attempts to parse any string entered into this property as a date. If the string cannot be parsed as a date, this property is set to the last valid date, or to the default text if no valid date has been entered.
In addition, an exception is generated. However, before the exception is thrown, the DatePicker raises the DateValidationError event, which can set the ThrowException property in the DatePickerDateValidationErrorEventArgs. If that property is set to false, the exception is not thrown. If you want to resolve validation errors yourself, you can handle this event and set ThrowException to false in order to suppress the exception.