Here is the psuedo code for what I want to do
IF NOT ISDIRTY
THEN VISIBILITY EQ VISIBILITY.COLLAPSED
IF ISDIRTY AND ISVALID
THEN VISIBILITY EQ VISIBILITY.VISIBLE AND COLOR = GREEN
IF ISDIRTY AND NOT ISVALID
THEN VISIBILITY EQ VISIBILITY.VISIBLE AND COLOR = RED
The Style for a ToggleButton below gets the conditions right on the first update but doesn't change thereafter.
For example, if I make a change that doesn't make the vm invalid, the color is correctly Green. But if I then make a change to make the vm invalid, it stays green, when it should be Red. Conversely, if the first update makes the vm invalid, the color is correctly set to Red, but a second update that corrects the invalid error but leaves the vm dirty does not change the color to Green.
What am I doing wrong?
I haven't tried the Visual State Manager yet, but would that be a preferred way to go? How might that look?
Usage
<Ellipse Style="{StaticResource EditedStateIndicatorStyle}"/>
the Style
<Style x:Key="EditedStateIndicatorStyle" TargetType="{x:Type Ellipse}">
<Setter Property="Width" Value="8" />
<Setter Property="Height" Value="8" />
<Setter Property="Margin" Value="8,0"/>
<Setter Property="SnapsToDevicePixels" Value="false" />
<Setter Property="Focusable" Value="False" />
<Style.Triggers>
<!-- Dirty, && NOT Valid -->
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsDirty}" Value="true"/>
<Condition Binding="{Binding IsValid}" Value="false"/>
</MultiDataTrigger.Conditions>
<Setter Property="Fill" Value="Red"/>
<Setter Property="ToolTip" Value="You got errors, fool!"/>
</MultiDataTrigger>
<!-- Dirty, but Valid -->
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsDirty}" Value="true"/>
<Condition Binding="{Binding IsValid}" Value="true"/>
</MultiDataTrigger.Conditions>
<Setter Property="Fill" Value="Green"/>
<Setter Property="ToolTip" Value="You made changes!"/>
</MultiDataTrigger>
<!-- Not Dirty, don't show anything -->
<DataTrigger Binding="{Binding IsDirty}" Value="false">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>