DataGrid 绑定(bind)到一些DataTable。 用户更改了一些值。我想用一些颜色标记更改的行。 我已经做到了。但是如何通知 DataGrid,当前行值已更改?
附言我在 currentRow.Row.RowState 上使用触发器来指示更改的行。我不想刷新所有 ItemsSource - 它的操作时间太长。
最佳答案
这些方面的一些东西可能有助于交配......它不准确,你可能必须在不同的事件句柄上调用它......但它应该给你一个正确方向的点!
private void dgv_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
int colIndex = e.ColumnIndex;
int rowIndex = e.RowIndex;
DataGridViewRow theRow = dgvOutstandingReports.Rows[rowIndex];
theRow.DefaultCellStyle.BackColor = Color.LightYellow;
}
关于c# - DataGrid绑定(bind)到DataTable时如何刷新DataGrid行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11341090/