I have a DataTable
that is displayed in a WPF grid view. All the columns are typed. There is a column of type DateTime
that when I display the table in the GUI shows the dates in MM/dd/yyy
format, I need to change the format since for my users that is very much prone to error. The desired format is dd/MM/yyyy
Example code:
DataTable dt = new DataTable();
dt.Columns.Add("date", typeof(DateTime));
dt.Columns.Add("val", typeof(double));
GridView gv = new GridView();
gv.ItemsSource = dt.DefaultView;
There are quite some questions relate to this one, but none actually solves the problem, just convert the content to string. (ie here) Instead of modifying the DataTable
to the format expected (or the GridView
)