I’m programmatically setting up my datagrid columns for my datagrid, then binding the grid to an observable collection.
A couple of my columns are bound to DateTime properties, however, if they’re null values in the database, it’s setting the DateTime properties to the min value due to DateTime being a non nullable type.
My binding is as follows for the aforementioned columns:
DataGridTextColumn scanned = new DataGridTextColumn();
scanned.Header = "Scanned";
scanned.Binding = new Binding("DateScanned");
dataGrid.Columns.Add(scanned);
“DateScanned” being the datetime property.
Now, instead of those values displaying in the grid as “1/1/0001”, I’d prefer it if they were blanked out.
Herein lies my question.
Can I set this binding up to be conditional somehow and if the property value is “1/1/0001”, display nothing?
Use a value converter to convert specific values like that to blank or whatever else you want.