Q:

Setting a Content of Label control using Triggers

I have got a Label in my ControlTemplate that I wish to change it's content if a trigger happens. I have tried so many different ways but no luck so far. This is the closest I come so far which I can change its apearance but not Content
<Style x:Key="PartOptionsItemStyle" TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource InnerListViewItemsStyle}">
  <Style.Setters>
    <Setter Property="Template">
      <Setter.Value>
        <ControlTemplate TargetType="{x:Type ListViewItem}">
          <Border>
            <Grid>
              <Label x:Name="OptionPrice" HorizontalAlignment="Right" Content="{Binding Path=PriceDom}" ContentStringFormat="{}{0:C}" >
                <Label.Resources>
                  <Style TargetType="{x:Type Label}">
                    <Style.Triggers>
                      <DataTrigger Binding="{Binding Path=PriceDom}" Value="0">
                        <Setter Property="Foreground" Value="Red"></Setter>
                        <Setter Property="Background" Value="Black"/>
                        <Setter Property="TextBlock.Text" Value="Free" />
                      </DataTrigger>
                    </Style.Triggers>
                  </Style>
                </Label.Resources>
              </Label>
            </Grid>
          </Border>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style.Setters>
</Style>

I initially tried to write this code in the ControlTemplate.Triggers such as below but that didn't even effect the appearance.
          <ControlTemplate.Triggers>
            <Trigger SourceName="OptionPrice" Property="Content"  Value="0">
              <Setter Property="Foreground" Value="Red" />
            </Trigger>
          </ControlTemplate.Triggers>

What would you do, and how would you do it?

A:

Label does not have Text property and you have set Content directly on Label. Update your xaml as below
       <Label x:Name="OptionPrice" HorizontalAlignment="Right" ContentStringFormat="{}{0:C}" >
            <Label.Style>
              <Style TargetType="{x:Type Label}">
                <Setter Property="Content" Value="{Binding Path=PriceDom}" />
                <Style.Triggers>
                  <DataTrigger Binding="{Binding Path=PriceDom}" Value="0">
                    <Setter Property="Foreground" Value="Red"></Setter>
                    <Setter Property="Background" Value="Black"/>
                    <Setter Property="Content" Value="Free" />
                  </DataTrigger>
                </Style.Triggers>
              </Style>
            </Label.Style>
          </Label>

