I am new to MVVM and cannot determine how I convert datetime values to short date time so they display correctly in my datagrid.
Can anyone provide some sample code to convert datetime to short date time correctly?
I am new to MVVM and cannot determine how I convert datetime values to short date time so they display correctly in my datagrid.
Can anyone provide some sample code to convert datetime to short date time correctly?
Your ViewModel is not supposed to specify how it is being displayed in the view. So your ViewModel just has a property with the DateTime object.
The actual formatting is then specified in the view; with WPF you do that in the binding with the StringFormat parameter:
{Binding MyDate, StringFormat=d}