Handling of BST DateTimes in DataGrid

Apr 2, 2009 at 10:51 AM
Hi there,

I have a DataGrid which is autogenerated via a datatable. One or more of the columns of this datatable may be of DateTime type. The DateTime values in the grid will be in UTC format (they are coming from the server).

Unfortunately, when the dates get rendered, they will not get rendered in BST time and are therefore one hour out. Can anyone suggest an automatic way of specifying that the Grid needs to perform a ToLocalTime on the dates it handles?

Alternatively, can anyone provide a solution to allow me to call a converter just for the columns that are of format DateTime? I do not know the format of the columns before it is genererated, so cannot attach a data template to a particular column in advance.

Thanks in advance for anyone who can help,

Phil
Coordinator
Apr 3, 2009 at 2:21 AM
You can listen to then DataGrid.AutoGeneratingColumn event which you are passed the property type and column.  There you can update the column to use a specfic date template that you require.