We have a XamDataGrid that has a Binding to an ObservableCollection that defines a property of type DateTime. The issue is that the default instance of this DataType is represented as 01/01/0001. We want to add a Converter or some style logic/trigger to show an empty Cell when 01/01/0001.
This really helps.
Hello Jesse,
Thank you for your feedback. I am glad that you resolved your issue.
We actually did this yesterday. So you answer is exactly what was needed. Thank you.
Thank you for contacting our community.
I have been looking into your post and what you could do in this case is using Nullable Types for the DateTime property. The default value of the DateTime type variables is 01/01/0001 and you could change it to null in order to display an empty cell when no date is chosen.
class MyObservableCollectionClass : BindingList
{
public MyObservableCollectionClass() : base() { }
DateTime ?newDate = null;
public BindingList GetCollection()
BindingList mycollection = new BindingList
new DataItem(3, "John", newDate),
new DataItem(2, "Smith", newDate),
new DataItem(1, "Mary", newDate),
};
return mycollection;
}
Please let me know if you have any other questions or concerns.