Hello, I would like to create programmatically an animation for the background color of a label but I have some problems.
I have implemented the following code:
  Public Sub DoBackgroundAnimation(ByVal obj As Label)
        If obj Is Nothing Then Return
        Dim animatedBrush As New SolidColorBrush()
        animatedBrush.Color = Colors.MidnightBlue
        Dim highlightAnimation As New ColorAnimation()
        highlightAnimation.[To] = Colors.Transparent
        highlightAnimation.Duration = TimeSpan.FromSeconds(1)
        Storyboard.SetTarget(highlightAnimation, animatedBrush)
        Storyboard.SetTargetProperty(highlightAnimation, New PropertyPath(SolidColorBrush.ColorProperty))
        Dim story As New Storyboard
        story.Children.Add(highlightAnimation)
        obj.Background = animatedBrush
        story.Begin(obj)
    End Sub
but nothing happens!
The background is simply colored MidnightBlue and no animation.
Do you have any suggestions?