I have this animation with me, a sort of blinking animation, such that when the button is clicked, the rectangle \"blinks\". I\'ve written a code for the animation, just wanted
Here is C# code version for someone who need it...
if (IsImageBlinking)
{
DoubleAnimation da = new DoubleAnimation();
da.From = 1.0;
da.To = 0.0;
da.RepeatBehavior = RepeatBehavior.Forever;
da.AutoReverse = true;
sb.Children.Add(da);
Storyboard.SetTargetProperty(da, new PropertyPath("(Image.Opacity)"));
Storyboard.SetTarget(da, image1);
sb.Begin();
}
From other hand there you can implement blinking for any control like this.
0 5 0 0
AlertArea is to generate blinking 3 times and when it is finished we have to restore Opacity
using AlertArea2.
In the constructor of UserControl/Window
..
Storyboard sb = this.FindResource("AlertArea") as Storyboard;
sb.Completed += Sb_Completed;
..
private void Sb_Completed(object sender, EventArgs e)
{
Storyboard sb2 = this.FindResource("AlertArea2") as Storyboard;
sb2.Begin();
}
In the place you need to start blinking do this
Dispatcher.BeginInvoke((Action)(() =>
{
Storyboard sb = this.FindResource("AlertArea") as Storyboard;
sb.Begin();
}));