Hello all,
Is it possible to apply custom formatting to a colum in WinGrid.
What I am trying to accomplish is format the TimeSpan class so that for example:
When it is larger than a day, it is formatted like this:
3d 04h 23m 14s
When it is smaller than a day but larger than one hour, like this
4h 23m 14s
and so on.
What is the easiest way to do this?
There are two basic ways to acheive this. The first is to hide the real column in the grid and use an Unbound column. Then you can use the InitializeRow event to translate the real value into a string. You would then use BeforeRowUpdate or maybe AfterCellUpdate to translate the string back into a TimeSpan and set the value in the hidden cell (assuming the field is updatable).
The other way to do it is to use a DataFilter, which is essentially the same thing, except you don't need the unbound column, you handle it on the editor level.