DevExpress provides the RowStyle
and RowCellStyle
events for their GridView
.
In each event, you can check the status of the currently styled row or cell, and change its appearance based on data within the row.
You could add a hidden bool field to your table that keeps track of the LastChanged rows. Before you scan a new bar code, you can just set this field to false for all rows, and set it to true only for rows which had their amount changed.
Then you could use one of the following event handlers to style the row or cell based on the data:
private void gridView_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
{
if (e.RowHandle < 0) return;
GridView view = sender as GridView;
DataRowView rowView = (DataRowView) view.GetRow(e.RowHandle);
if ((bool)rowView["LastChanged"])
e.Appearance.BackColor = Color.Yellow;
else
e.Appearance.BackColor = Color.White;
}
Or if you only wanted to color the Amount cell.
private void gridView_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
{
if (e.RowHandle < 0) return;
if (e.Column.Name != "Amount") return;
DataRowView rowView = (DataRowView)(((GridView)sender).GetRow(e.RowHandle));
if ((bool)rowView["LastChanged"])
e.Appearance.BackColor = Color.Yellow;
else
e.Appearance.BackColor = Color.White;
}