How to animate a DropShadowEffect's
color that has been already applied to an element with XAML
without the need to re-apply a new DropShadowEffect
?
I tried this:
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);
}
But DS_Moon
returns Null
!!
I just realized that i can do this:
Moon.Effect.BeginAnimation(DropShadowEffect.ColorProperty, (AnimationTimeline)DS_Moonlight);