Hello,
I am using a ultrawingrid control and am trying to change the cell color whenever a user changes a cell in the grid. I am using the following code. This works fine for everything except in one case. When the originalvalue is null and user enters a new value. In this case, both the original value and the value property are shown the same (i.e the new value entered). So the color doesn't change (based on my logic below).
void objGrid_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { bool valChanged = false; if (e.Cell.Value == null && e.Cell.OriginalValue == null) { valChanged = false; } else if (e.Cell.Value == null && e.Cell.OriginalValue != null) { valChanged = true; } else if (e.Cell.Value != null && e.Cell.OriginalValue == null) { valChanged = true; } else if (e.Cell.Value.ToString() != e.Cell.OriginalValue.ToString()) { valChanged = true; } if (valChanged) { e.Cell.Appearance.BackColor = Color.BlanchedAlmond; e.Cell.Row.RowSelectorAppearance.BackColor = Color.BlanchedAlmond; } }
I can't see why this would be happening or why the data source would make a difference. But it's hard to tell anything from a code snippet.
I recommend that you create a small sample project demonstrating this behavior and then either post it here or Submit an incident to Infragistics Developer Support.
I wanted to mention that this works fine when you bind a dataTable. But when you use LINQ to bind the datagrid, there is an issue.