I am looking to modify a DataRowView value from an event.
I have tried the following but it never changes the DataGridCheckBoxColumn
((DataRowView)repDataGrid.SelectedItem).Row.ItemArray[4] = true;
I am looking to modify a DataRowView value from an event.
I have tried the following but it never changes the DataGridCheckBoxColumn
((DataRowView)repDataGrid.SelectedItem).Row.ItemArray[4] = true;
ItemArray
creates a new object[]
which can be used to read the values. But you can't use it to set them. You can use the DataRow
indexer:
((DataRowView)repDataGrid.SelectedItem).Row[4] = true;
If you wanted to use ItemArray
to assign the values you have to re-assign it:
DataRow row = (DataRowView)repDataGrid.SelectedItem).Row;
object[] fields = row.ItemArray;
fields[4] = true;
row.ItemArray = fields;