I’m a bit confused here, so please help me out.
I’ve got a simple wpf animation:
<DropShadowEffect Color="Transparent" ShadowDepth="0" Opacity="0.75" x:Key="Shiny" x:Shared="False"/>
<Storyboard x:Key="ShinyAnim" x:Shared="False">
<ColorAnimation From="Transparent" To="Red" Duration="0:0:1" Storyboard.TargetProperty="(Effect).Color" />
<DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetProperty="(Effect).BlurRadius" AutoReverse="True">
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.15" Value="2"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.3" Value="3"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.45" Value="4"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.6" Value="5"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.75" Value="6"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:0.9" Value="7"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:1.05" Value="8"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:1.2" Value="9"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:1.35" Value="10"/>
<DiscreteDoubleKeyFrame KeyTime="0:0:1.5" Value="11"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Style x:Key="AnimShape" TargetType="Shape">
<Setter Property="Stroke" Value="DarkGray"/>
<Setter Property="Effect" Value="{StaticResource Shiny}/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasChannelWarnings}" Value="True">
<Setter Property="Stroke" Value="Red"/>
<DataTrigger.EnterActions>
<BeginStoryboard x:Name="ChannelAnim" Storyboard="{StaticResource ShinyAnim}"/>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<RemoveStoryboard BeginStoryboardName="ChannelAnim"/>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
if i load the control with this style, while HasChannelWarnings==false – everything works fine: when the property changes – i get the shiny animation. However if i load the control, when HasChannelWarnings==true i get an error:
Cannot resolve all property references in the property path ‘(Effect).Color’. Verify that applicable objects support the properties.
Can some1 explain me whats going on? Does trigger fire before effect setter? If so, how to apply this animation properly?
I solved this by changing trigger to multitrigger
But i dont really like this solution. There must be a better way.