Roberto Salemi

Roberto Salemi

  • NA
  • 146
  • 141.2k

[WPF] DatePicker: show only date and StringFormat

Feb 24 2015 6:36 AM

Hi,

in my grid I'm using a DatePicker (for show and edit):

- How can I show only date and hide time?

- When I edit the cells with Datepicker the format of date is "MM/dd/yyyy", how can I convert it in "dd/MM/yyyy"?

Thanks.

<DataGridTemplateColumn Header="{StaticResource datagridDatetime}">

<DataGridTemplateColumn.CellTemplate>

<DataTemplate>

<TextBlock Text="{Binding DateTime, Mode=OneWay, StringFormat='dd/MM/yyyy'}"></TextBlock>

</DataTemplate>

</DataGridTemplateColumn.CellTemplate>

<DataGridTemplateColumn.CellEditingTemplate>

<DataTemplate>

<DatePicker SelectedDate="{Binding DateTime, StringFormat='dd/MM/yyyy'}"   />

</DataTemplate>

</DataGridTemplateColumn.CellEditingTemplate>

</DataGridTemplateColumn>


Thanks.


Answers (1)