Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
250
Conditional cell formatting question
posted

I have a grid that is bound to a custom class that implements IBindingList.

One of the columns is readonly and displays a DateTime value.  I would like to format the DateTime value such that if the value is today, it is "hh:mm:ss".  If the date is before today, I would format it "dd/MM/yyyy".

I cannot use the column format as that is not conditional.

I could change the ListObject implementation to return a formatted string, however that breaks the column filtering.  In other words, greater than filtering does a string compare, rather that a date compare.

Is there anyway to apply this kind of conditional formatting, or to override the filtering logic, such as using a custom IComparer for filtering.

Thanks.

Parents Reply Children
No Data