title: How to change text color for ListBox element using Triggers?
body: <p>I have a ListBox (SurfaceListBox) and I need to change the text color for an element when the element has false on a specific property. </p>
  
  <p>Looking at my code this works fine:</p>
  
  <pre><code>&lt;DataTrigger Binding="{Binding IsSelectable}" Value="False"&gt;
  </code></pre>
  
  <p>but setting the color using:</p>
  
  <pre><code>&lt;Setter Property="Foreground" Value="Black"/&gt;
  </code></pre>
  
  <p>does not work, and color is not changed.</p>
  
  <p>Any idea how to solve it, or an alternative approch?</p>
  
  <pre><code>&lt;Style x:Key="CategorySurfaceListBoxItemStyle"
          TargetType="{x:Type Custom:SurfaceListBoxItem}"
          BasedOn="{StaticResource ControlBaseStyle}"&gt;
  
      &lt;Setter Property="Template"&gt;
          &lt;Setter.Value&gt;
              &lt;ControlTemplate TargetType="{x:Type Custom:SurfaceListBoxItem}"&gt;
                  &lt;Grid
                      x:Name="Grid"
                      Background="{StaticResource ControlHitAreaBrush}"
                      SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"&gt;
                      &lt;ContentPresenter x:Name="Content" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Center" VerticalAlignment="Center"/&gt;
                  &lt;/Grid&gt;
              &lt;/ControlTemplate&gt;
          &lt;/Setter.Value&gt;
      &lt;/Setter&gt;
      &lt;!-- Disable dot items --&gt;
      &lt;Style.Triggers&gt;
          &lt;DataTrigger Binding="{Binding IsSelectable}" Value="False"&gt;
              &lt;Setter Property="IsEnabled" Value="False"/&gt;
              &lt;Setter Property="Foreground" Value="Black"/&gt; &lt;!--PROBLEM HERE--&gt;
          &lt;/DataTrigger&gt;
      &lt;/Style.Triggers&gt;
  &lt;/Style&gt;
  </code></pre>