title: Property or Data Trigger in WPF Path object
body: <p>I have a TextBlock and two path objects (Up arrow &amp; Down arrow) in a Stack Panel. The TextBlock is bound to a Property called 'Change', which possibly can have values such as -1,0,1.</p>
  
  <p><strong>Problem</strong>
  I wanted to show Up arrow in case of 1 OR Down arrow in case of -1 OR show neither of these Path object in case of 0.</p>
  
  <p>In order to achieve this, I defined a Style Trigger on Path type.</p>
  
  <p><strong>Question</strong></p>
  
  <p>I am not able to get it work. Am i missing something or is there better way of doing this.</p>
  
  <p><strong>XAML</strong></p>
  
  <pre><code>&lt;StackPanel Orientation="Horizontal"&gt;
      &lt;TextBlock Name="changeLbl" Margin="0,0,10,0" Text="{Binding Path=Change}"/&gt;
           &lt;Path Fill="{Binding ElementName=changeLbl,Path=Foreground}" Style="{StaticResource downChangePathTrigger}"/&gt;
                  &lt;Path Fill="{Binding ElementName=changeLbl,Path=Foreground}" Style="{StaticResource upChangePathTrigger}"/&gt;
                  &lt;/StackPanel&gt;
  </code></pre>
  
  <p><strong>Style resource</strong></p>
  
  <pre><code>&lt;Style x:Key="upChangePathTrigger" TargetType="Path"&gt;
              &lt;Setter Property="Visibility" Value="Collapsed" /&gt;
              &lt;Setter Property="HorizontalAlignment" Value="Center" /&gt;
              &lt;Setter Property="VerticalAlignment" Value="Center" /&gt;
              &lt;Setter Property="Data" Value="M 0 4 L 4 0 L 8 4 Z" /&gt;
              &lt;Setter Property="StrokeThickness" Value="5" /&gt;
              &lt;Setter Property="Stroke" Value="GreenYellow"/&gt;
              &lt;Style.Triggers&gt;
                  &lt;Trigger Property="Fill" Value="GreenYellow"&gt;
                      &lt;Setter Property="Visibility" Value="Visible"/&gt;
                  &lt;/Trigger&gt;
                  &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
          &lt;Style x:Key="downChangePathTrigger" TargetType="Path"&gt;
              &lt;Setter Property="Visibility" Value="Collapsed" /&gt;
              &lt;Setter Property="HorizontalAlignment" Value="Center" /&gt;
              &lt;Setter Property="VerticalAlignment" Value="Center" /&gt;
              &lt;Setter Property="Data" Value="M 0 0 L 4 4 L 8 0 Z" /&gt;
              &lt;Setter Property="StrokeThickness" Value="5" /&gt;
              &lt;Setter Property="Stroke" Value="Red"/&gt;
              &lt;Style.Triggers&gt;
                  &lt;Trigger Property="Fill" Value="Red"&gt;
                      &lt;Setter Property="Visibility" Value="Visible"/&gt;
                  &lt;/Trigger&gt;
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
  </code></pre>
  
  <p><strong>Update with answer</strong></p>
  
  <p><em>Style trigger</em></p>
  
  <pre><code>&lt;Style x:Key="changePathTrigger" TargetType="Path"&gt;
              &lt;Setter Property="Visibility" Value="Hidden" /&gt;
              &lt;Setter Property="HorizontalAlignment" Value="Center" /&gt;
              &lt;Setter Property="VerticalAlignment" Value="Center" /&gt;
              &lt;Setter Property="StrokeThickness" Value="5" /&gt;
              &lt;Style.Triggers&gt;
                  &lt;!--&lt;DataTrigger Binding="{Binding Path=Change,Converter={StaticResource doubleToIntConverter}}" Value="0"&gt;
                      &lt;Setter Property="Stroke" Value="0"/&gt;
                  &lt;/DataTrigger&gt;--&gt;
                  &lt;DataTrigger Binding="{Binding Path=Change,Converter={StaticResource doubleToIntConverter}}" Value="1"&gt;
                      &lt;Setter Property="Visibility" Value="Visible"/&gt;
                      &lt;Setter Property="Data" Value="M 0 4 L 4 0 L 8 4 Z"/&gt;
                      &lt;/DataTrigger&gt;
                  &lt;DataTrigger Binding="{Binding Path=Change,Converter={StaticResource doubleToIntConverter}}" Value="-1"&gt;
                      &lt;Setter Property="Visibility" Value="Visible"/&gt;
                      &lt;Setter Property="Data" Value="M 0 0 L 4 4 L 8 0 Z"/&gt;
                      &lt;/DataTrigger&gt;
              &lt;/Style.Triggers&gt;
          &lt;/Style&gt;
  </code></pre>
  
  <p><em>Xaml</em></p>
  
  <pre><code>&lt;Path Fill="{Binding ElementName=changeLbl,Path=Foreground}" Stroke="{Binding ElementName=changeLbl,Path=Foreground}" Style="{StaticResource changePathTrigger}"/&gt;
  </code></pre>