I want to change the background of certain cells in response to data value changes of other cells. So i hook the DataValueChanged and ...
private void xamDataGrid1_DataValueChanged(object sender, DataValueChangedEventArgs e){ var recordPresenter = e.Record; var record = e.Record.DataItem as MyObject; if (record == null) return; if (record.TargetValue != record.ActualValue) { //i can change the background of the originating cell e.CellValuePresenter.Background = Brushes.LightSalmon; // but i want to change the other cell as well... var cell = recordPresenter.Cells["TargetValue"]; // HOW DO I GET THE CellValuePresenter OF THIS CELL?? }}
Hello Martin,
Thank you for your post. I have been looking into it and I can suggest you use the CellValuePresenter’s FromCell static method in order to get the CellValuePresenter from a certain Cell like this:
CellValuePresenter cvp = CellValuePresenter.FromCell(cell);
Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.