I have a table that I have to show in a DataGrid. One of the columns in the
table is column that shows some states. When reading it, the states will be
one of -2, -1, 1 or 2. After the user modifies the column, it will have to
save -2 for false and 2 for true. The problem is that I have to show these
values as a check box, i.e. for each value < 0 to show an unchecked checkbox
and for values > 0 to show a checked checkbox.
I tried to make my own class derived from DataGridBoolColumn and to override
the methods SetColumnValueAtRow and GetColumnValueAt Row. Here is the code:

protected override object GetColumnValueAtRow(CurrencyManager lm, int row)
{
DataView view = (DataView)lm.List;
if(Convert.ToInt32(view[row].Row[this.MappingName]) > 0)
{
return true;
}
else
{
return false;
}
}

protected override void SetColumnValueAtRow(CurrencyManager source, int
rowNum, object value)
{
DataView view = (DataView)source.List;
if(Convert.ToBoolean(view[rowNum].Row[this.MappingName]))
{
value = 2;
}
else
{
value = -2;
}
}

Well... the problem is that it doesn't work too well. I can see the checks
all right, but I cannot change them. I think that the problem is that I don't
understand too well the role of the CurrencyManager object. I couldn't find
any example on the net on how to override SetColumnValueAtRow.

If anybody knows how to do it or has another idea please post it. Thank you!