I have a set of triggers in the form of XAML, and for life I canβt understand why one set works and the other does not, despite the fact that it is associated with the same variable.
First, triggers that work:
<StackPanel Orientation="Vertical" Margin="25,0,0,0">
<StackPanel.Style>
<Style TargetType="{x:Type StackPanel}">
<Setter Property="IsEnabled" Value="False" />
<Style.Triggers>
<DataTrigger Binding="{Binding GorOption.InternalName}" Value="Separator">
<Setter Property="IsEnabled" Value="True" />
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
</StackPanel>
<StackPanel Orientation="Vertical" Margin="25,0,0,0">
<StackPanel.Style>
<Style TargetType="{x:Type StackPanel}">
<Setter Property="IsEnabled" Value="False" />
<Style.Triggers>
<DataTrigger Binding="{Binding GorOption.InternalName}" Value="BubblePoint">
<Setter Property="IsEnabled" Value="True" />
</DataTrigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
</StackPanel>
This trigger works beautifully. Now I have GroupBox and Label with very similar triggers that don't work at all. Triggers that do not work:
<GroupBox Header="Recombined Gas" Grid.Row="1" Grid.ColumnSpan="2">
<GroupBox.Style>
<Style TargetType="{x:Type GroupBox}">
<Setter Property="Header" Value="Recombined Gas" />
<Style.Triggers>
<DataTrigger Binding="{Binding GorOption.InternalName}" Value="Separator">
<Setter Property="Header" Value="Separator Gas" />
</DataTrigger>
<DataTrigger Binding="{Binding GorOption.InternalName}" Value="BubblePoint">
<Setter Property="Header" Value="Dissolved Gas" />
</DataTrigger>
</Style.Triggers>
</Style>
</GroupBox.Style>
</GroupBox>
And the label trigger does not work:
<Label Content="Reombined GOR" Width="90">
<Label.Style>
<Style TargetType="{x:Type Label}">
<Setter Property="Content" Value="Recombined GOR" />
<Style.Triggers>
<DataTrigger Binding="{Binding GorOption.InternalName}" Value="Separator">
<Setter Property="Content" Value="Separator GOR" />
</DataTrigger>
<DataTrigger Binding="{Binding GorOption.InternalName}" Value="BubblePoint">
<Setter Property="Content" Value="Dissolved GOR" />
</DataTrigger>
</Style.Triggers>
</Style>
</Label.Style>
</Label>
, - , . , . , DataTrigger, ? , , , . - Label GroupBox?