How to change cell's format by binding

Jan 8, 2010 at 3:22 PM


I am a new one here and having a problem with datagrid format.

I have a datagrid bound to a class. One column's values are decimal, some have fraction and some do not have fraction (12.34 or 45.00). What I need to do is to show them differently, like 12.34 (with fraction) or 45 (without fraction).

I tried to do it by creating a custom ValueConverter. But when I tried to change the format cell by cell, I got the exception said "binding cannot be changed after it has been used".

Does anyone know how to solve it or other way to achive this goal?

Thanks a lot in advance.