title: Animate background opacity of *any* wpf control
body: <p>I want an effect where I can animate the background opacity of any GroupBox control.<br>
  This would give me additional visual notification if something changes - I can flash the control to indicate the new status.</p>
  
  <p>I have</p>
  
  <pre><code>private void ToggleBackgroundFade(Control control)
  {
      var duration = new TimeSpan(0, 0, 0, 0, 200);
  
      var animation = new DoubleAnimation { From = 1.0, To = 0.0, Duration = new Duration(duration) };
      // new brush because old one is frozen
      control.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xD6, 0xEF, 0xD1));
      control.Background.BeginAnimation(OpacityProperty, animation);
  }
  
  private void KickoffFlashingAnimation(Control controlToFade)
  {
      controlToFade.Dispatcher.BeginInvoke(new Action(() =&gt; 
          ToggleBackgroundFade(controlToFade))
      );
  }
  </code></pre>
  
  <p>and all with style</p>
  
  <pre><code>&lt;Style x:Key="GroupBoxHeader" TargetType="{x:Type GroupBox}"&gt;
      ...
      &lt;Setter Property="Background" Value="#00D6EFD1" /&gt;
  &lt;/Style&gt;
  </code></pre>
  
  <p>so I want to pass any GroupBox to the KickoffFlashingAnimation() method.</p>
  
  <p>It runs fine, with no errors, but the groupbox doesn't change color after initially being set to the light green #ffd6efd1..<br>
  Any tips?</p>