Simple question, really. I have the following button defined with some simple bindings & style triggers:
<Button HorizontalAlignment="Stretch" VerticalAlignment="Stretch" BorderBrush="Transparent" BorderThickness="0" Command="{Binding AcceptValueInputCommand}">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
<DataTrigger Binding="{Binding ValueInputEnabled}" Value="True">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding IsPredefined}" Value="True">
<Setter Property="Background" Value="Red" />
<Setter Property="Foreground" Value="Black" />
</DataTrigger>
</Style.Triggers>
<Setter Property="Visibility" Value="Visible"/>
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="Black" />
</Style>
</Button.Style>
<Viewbox>
<TextBlock Text="{Binding Value}" />
</Viewbox>
</Button>
The problem I'm having is that my trigger on "IsPredefined" is not setting the background of the button to red. The foreground does get set properly to black (though I don't know why it didn't pick that up from the setters that are outside the style). I think the problem has something to do with the command binding on the button, because if I comment out the binding, all of the sudden the button is red! (Note, in all circumstances when "IsPredefined" evaluates to true, the command's CanExecute() should be evaluating to false). Any ideas?
(Edited to add in foreground of black to the IsPredefined trigger).