Gets the text that is displayed by the DatePicker, or sets the selected date.
Assembly: PresentationFramework (in PresentationFramework.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
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. While the property can be set to any string that can be parsed by the Parse method date, the format of the string that is returned depends on the value of the CultureInfo::CurrentCulture property. This means that the DatePicker might display a string that is different than what the user typed.
If is set to a date that is selectable and valid, the DateValidationError event occurs. If you handle the DateValidationError event and set the ThrowException property to true, a FormatException or ArgumentOutOfRangeException is raised.
The following example creates a DatePicker that has the date August 10, 2009 selected. The example also binds the property to a TextBlock. Because the SelectedDateFormat property is set to Long, the DatePicker and TextBlock displays the date using unabbreviated days of the week and month names even if the user enters a short form of a date.