title: Change the foreground of a datagrid cell
body: <p>I open my datagrid, showing numerical values in black on some columns, the same data are written in red on other columns, just to say no values are really present there, hasn't been edited. If someone change the numbers in red they should became black.</p>
  
  <p>I have write in xaml one style for the DatagridCell -</p>
  
  <pre><code>&lt;Window.Resources&gt;
      &lt;Style x:Key="D3ForegroundStyle" TargetType="{x:Type DataGridCell}" &gt;
          &lt;Setter Property="Foreground" Value="Black" /&gt;
          &lt;Style.Triggers&gt;
              &lt;DataTrigger Binding="{Binding Path=D3StatusVal}" Value="inherited"&gt;
                  &lt;Setter Property="Foreground" Value="Red" /&gt;
              &lt;/DataTrigger&gt;
          &lt;/Style.Triggers&gt;
      &lt;/Style&gt;
  &lt;/Window.Resources&gt;
  </code></pre>
  
  <p>D3StatusVal it's a string which value could be "normal" or "inherited".
  The style is linked to column in this way:</p>
  
  <pre><code>                &lt;DataGridTextColumn.CellStyle&gt;
                      &lt;Style TargetType="{x:Type DataGridCell}" BasedOn="{StaticResource D3ForegroundStyle}"/&gt;
                  &lt;/DataGridTextColumn.CellStyle&gt;
  </code></pre>
  
  <p>the first time, soon after I open the window, datagrid has been filled in a proper manner as I like, accordingly with the value of D3StatusVal, some values are shown black other red. After this if I try to change the data of the cells nothing happens (I mean with the cell color), even though the value of D3StatusVal is changed, and one event of PropertyChanged (with the x:name of column) is called
  Thanks in advance.</p>
  
  <p>No any hint at regards?! Ok, I would pose the question in a more general manner.
  Let say, I would like to change programmatically the foreground of a cell every time I change its contents (not dependent of value write in cell), what's the correct method to do it?</p>