我在我的公共模块上定义了故事板:
<Storyboard
x:Key="stbMessage"
>
<Storyboard.TargetProperty>Opacity</Storyboard.TargetProperty>
<Storyboard.Duration>0:0:4</Storyboard.Duration>
<DoubleAnimationUsingKeyFrames>
<LinearDoubleKeyFrame Value="1" KeyTime="0:0:0.3" />
<DiscreteDoubleKeyFrame Value="1" KeyTime="0:0:2.7" />
<LinearDoubleKeyFrame Value="0" KeyTime="0:0:3" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
现在我希望在我的所有模块中引用此故事板并根据所需情况设置 TargetProperty 。
<!-- some event occured, starting storyboard -->
<interactions:ControlStoryboardAction Storyboard="{StaticResource Stb_controlvalue}" Storyboard.TargetName="controlvaluetext" />
但是,在DoubleAnimationUsingKeyFrames中未指定目标时会发生错误。
如果我在Storyboard定义上设置了TargetName,那么它就可以了。
什么事?