I need to do the following with a DataGrid. E.g.
Col A Col B
1 A
2 B
3 C
4 D
For instance where Col A = 3. I then want to change the background cell.Background = some color where row 3 intersects Col B. I would be passing in the value for Col A and column name dynamically. I am returning the cell values from a DataTable where the DataGrid is bound to a defaultview of the DataTable. Col A is the unique key.
Found a solution with a single line of code to pragmatically set the current cell based on the items and column index for anyone else who may be looking for a solution to this as well.
In the XAML ensure the SelectionUnit is set to cell. Then:
dg.CurrentCell = new DataGridCellInfo(dg.Items[0],dg.Columns[0]);