0

I am trying to change the foreground color of a DataGrid cell.

I am trying to use a class extending IMultiValueConverter and I'd like to bind it the item used to generate a row and to the name of the column.

I read other Q&A and I saw they suggest to use a MultiBinding but I am not sure about how I could add the bindings

mariosangiorgio
  • 5,520
  • 4
  • 32
  • 46
  • 1
    I think that you might have some trouble doing that. To access the cell, you'd generally use the `DataGrid.CellStyle` Property and to access the row, you'd usually use the `DataGrid.RowStyle` Property, so combining them might be tricky. What *exactly* are you trying to do... there might be a better (or easier) way to accomplish it. – Sheridan Jun 09 '14 at 13:32
  • Are you trying to change foreground in a random cell or in some specific column only? – icebat Jun 09 '14 at 13:39
  • My high level goal is to change the foreground color of the cells that have a different value than the cell in the same column in the previous (according to the original sorting) row. – mariosangiorgio Jun 09 '14 at 13:42

1 Answers1

0

I managed to solve my issue.

I needed to change the properties I wanted to highlight with a different color decorating them so that they now contain the information about whether their value needed special formatting.

Then I created a binding for each DataGrid column as it is described in this other Q&A. I bound the decorated property and I used an IValueConverter to obtain the Brush color I wanted to use.

Community
  • 1
  • 1
mariosangiorgio
  • 5,520
  • 4
  • 32
  • 46