Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF DatePicker to show the time as well as the date

I have a DatePicker object in a DataGrid that successfully shows the date from the database or a property:

<DataGridTemplateColumn.CellTemplate>
   <DataTemplate>
      <DatePicker SelectedDate="{Binding Date, StringFormat=dd/MM/yyyy}"/>
   </DataTemplate>   
</DataGridTemplateColumn.CellTemplate>

Now I want to show the time in front of the date. This is what I tried, but it doesn't work:

<DataGridTemplateColumn.CellTemplate>
   <DataTemplate>
      <DatePicker SelectedDate="{Binding Date, StringFormat='dd/MM/yyyy HH:mm:ss'}"/>
   </DataTemplate>   
</DataGridTemplateColumn.CellTemplate>

NOTE: I do not want to do this in the code-behind.

like image 314
user3428422 Avatar asked Sep 10 '14 11:09

user3428422


1 Answers

Use the extended DateTimePicker

like image 52
zaman Avatar answered Jan 04 '23 08:01

zaman