WPF DatePicker control
Posted on 2011-05-12
In WinForms, it's possible to customize the display format of the control itself. I'd just set the format to custom, and specify a custom format (i.e., "yyyy-MM-dd HH:mm:ss"). In this case, the display value on the control would show something like "2011-05-12 16:30:00".
I'd like to use this same functionality in a WPF solution but I can't seem to determine how to do it. As best as I can tell, the only format-related property that I can manipulate on the DatePicker is the SelectedDateFormat, which can only be set to Long or Short. By default the control assumes a time of midnight, however if the user manually types the date (including a time), the DatePicker seems to use this as the selected datetime.
How can I get it to actually show the time in addition to the date on the control itself?