【发布时间】:2019-11-07 22:54:57
【问题描述】:
我正在尝试为用户控件的通用主题内设置投影动画
给定
<Border x:Name="PART_ClearBorder"
<Border.Effect>
<DropShadowEffect ShadowDepth="2" />
</Border.Effect>
里面
<ControlTemplate.Triggers>
我有
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition SourceName="PART_Clear" Property="IsMouseOver" Value="True" />
<Condition Property="HasText" Value="True" />
</MultiTrigger.Conditions>
<Setter TargetName="PART_Clear" Property="Foreground" Value="{StaticResource ClearHighlightBrush}" />
<MultiTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation AutoReverse="True"
Duration="0:0:0.5"
From="0"
Storyboard.TargetName="{Binding ElementName=PART_ClearBorder}"
Storyboard.TargetProperty="(Effect).(DropShadowEffect.ShadowDepth)"
To="30" />
</Storyboard>
</BeginStoryboard>
</MultiTrigger.EnterActions>
</MultiTrigger>
注意重要的部分是试图针对 ShadowDepth 属性的双重动画
当我运行项目时会抛出System.Windows.Markup.XamlParseException
我还在 xaml 主窗体中得到下划线
错误 2 无法冻结此 Storyboard 时间线树以供跨平台使用 线程。
正确样板故事板的正确方法是什么?
【问题讨论】: