[RESOLVED] Displaying null date in DataGrid
Okay, I've got a DataGrid that is displaying data from our database, except when it runs across a NULL datetime value in the database it displays it as "1/1/0001 12:00:00 AM". I'd MUCH rather have it show an empty field in that case... how do I get it to do that?
This is how I've got the control defined in the DataGrid's XAML.
Code:
<DataGridTemplateColumn Header="Start Date">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding EffDateBegin}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<DatePicker SelectedDate="{Binding EffDateBegin}"/>
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>
I'm using .NET 4.5 in a wpf app...
Re: Displaying null date in DataGrid
Hello,
This seems to be a WPF question, so I am going to move this thread to the WPF Forum. Please let me know if you have any questions.
Thanks
Gary
Re: Displaying null date in DataGrid
I figured this one out a few minutes ago. The solution was to implement a converter for the field and display an empty string for the null dates.