Possible Duplicate:
Unable to change DataRow value
I bound a datatable to a datagrid. Now I would like to change the datatable's value corresponding to the row of the selected cell once a button is clicked. Here is my code:
private void BtnModifyColorBlue_Click(object sender, RoutedEventArgs e)
{
if (dataGrid.SelectedCells.Count < 1)
return;
DataGridCellInfo dc = dataGrid.SelectedCells.FirstOrDefault();
DataRowView drv = dc.Item as DataRowView;
if (drv == null)
return;
drv.Row.ItemArray[11] = Brushes.Blue;
}
For some reason, after the assignment, the datatable's value is untouched. Are there any mysterious things happening here? BTW, I can conform that the assignment has been executed. Thanks a lot.