如何使用DropShadowEffect's
为已经应用于元素的XAML
颜色设置动画,而无需重新应用新的DropShadowEffect
?
我试过了:
private void test()
{
DropShadowEffect DS_Moon = (DropShadowEffect)Application.Current.Resources["DS_Moon"];
ColorAnimation DS_Moonlight = new ColorAnimation();
DS_Moonlight.From = new Color()
{
A = (byte)1,
R = (byte)0,
G = (byte)0,
B = (byte)0
};
DS_Moonlight.To = new Color()
{
A = (byte)1,
R = (byte)255,
G = (byte)255,
B = (byte)255
};
DS_Moon.BeginAnimation(SolidColorBrush.ColorProperty, (AnimationTimeline)DS_Moonlight);
}
但是DS_Moon
会返回Null
!!
答案 0 :(得分:1)
我刚才意识到我能做到这一点:
Moon.Effect.BeginAnimation(DropShadowEffect.ColorProperty, (AnimationTimeline)DS_Moonlight);