Reputation: 3641
Here is my code. Visibillity changes successfully but Fill doesnt...( I know that I wont see the difference because I set it to collapsed but without visibility setter color doesnt change)
<Rectangle Fill="#FFC8B65E" Stroke="#FF353434" RadiusX="5" RadiusY="7" StrokeThickness="2">
<Rectangle.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding TableOrder}" Value="{x:Null}">
<Setter Property="Shape.Fill" Value="White" />
<Setter Property="Rectangle.Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
It seems that <Rectangle Fill="#FFC8B65E"
is more important..
Upvotes: 1
Views: 461
Reputation: 5719
Have a look at the answer here: WPF Style: how to change GradientStop Color in Trigger It should help you solve your problem (use resources).
Upvotes: 0
Reputation: 63105
try removing Fill="#FFC8B65E"
because of Dependency Property Value Precedence even you set style property it will be ignored.
Upvotes: 1