title: Conditional foreground color on selected DataGrid row
body: <p>I have a <code>DataGrid</code> bound to a <code>CollectionViewSource</code> being populated from a database. Some of these items are "active" while others are "inactive." I would like the inactive rows to have a different foreground color, which I have managed to do, but the color does not apply selected rows. It seems that the <code>System.HighlightTextBrushKey</code> overrides any attempts at changing the highlighted color. Here is the code that works for non-selected cells.</p>
  
  <pre><code>&lt;DataGrid.Resources&gt;
      &lt;SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="{StaticResource ThemeHighlightColor}"/&gt;
      &lt;SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="{StaticResource ThemeHighlightColor}"/&gt;
      &lt;SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black"/&gt;
      &lt;Style TargetType="{x:Type DataGridRow}"&gt;
          &lt;Style.Triggers&gt;
              &lt;DataTrigger Binding="{Binding Path=active}" Value="False"&gt;
                  &lt;Setter Property="Foreground" Value="DarkOrchid"/&gt;
                  &lt;Setter Property="FontWeight" Value="DemiBold"/&gt;
              &lt;/DataTrigger&gt;
              &lt;DataTrigger Binding="{Binding Path=active}" Value="True"&gt;
                  &lt;Setter Property="Foreground" Value="Black"/&gt;
                  &lt;Setter Property="FontWeight" Value="Normal"/&gt;
              &lt;/DataTrigger&gt;
          &lt;/Style.Triggers&gt;
      &lt;/Style&gt;
  &lt;/DataGrid.Resources&gt;
  </code></pre>
  
  <p>In the above case, the "inactive" rows will take on the DemiBold font, even if selected, but only unselected rows take on the DarkOrchid color. Instead, they use the <code>SystemColors.HighlightTextBrushKey</code> color of Black (even if I don't explicitly state this, these selected rows use the default <code>SystemColors.HighlightTextBrushKey</code> color of white).</p>
  
  <p>I tried using a <code>MultiTrigger</code> instead of the above <code>DataTriggers</code> but I have the exact same problem (font is bold, but remains black). Here is the <code>MultiTrigger</code>:</p>
  
  <pre><code>&lt;MultiDataTrigger&gt;
      &lt;MultiDataTrigger.Conditions&gt;
          &lt;Condition Binding="{Binding Path=active}" Value="False"/&gt;
          &lt;Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsSelected}" Value="True"/&gt;
      &lt;/MultiDataTrigger.Conditions&gt;
      &lt;MultiDataTrigger.Setters&gt;
          &lt;Setter Property="Foreground" Value="DarkOrchid"/&gt;
          &lt;Setter Property="FontWeight" Value="DemiBold"/&gt;
      &lt;/MultiDataTrigger.Setters&gt;
  &lt;/MultiDataTrigger&gt;
  </code></pre>
  
  <p>I can't find a solution to this anywhere. Is there some way to make the foreground color on a selected row conditional on some bound value?</p>