private static Storyboard CreateBlinkingEffect(DependencyObject target)
{
var storyboard = new Storyboard
{
RepeatBehavior = RepeatBehavior.Forever,
Duration = TimeSpan.FromSeconds(1.2)
};
var animation = new ObjectAnimationUsingKeyFrames();
animation.KeyFrames.Add(new DiscreteObjectKeyFrame
{
KeyTime = TimeSpan.FromSeconds(0.0),
Value = 0.0
});
animation.KeyFrames.Add(new DiscreteObjectKeyFrame
{
KeyTime = TimeSpan.FromSeconds(0.6),
Value = 1.0
});
storyboard.Children.Add(animation);
Storyboard.SetTarget(storyboard, target);
Storyboard.SetTargetProperty(storyboard, "Opacity");
return storyboard;
}