Exemplo n.º 1
0
 /// <summary>
 /// Animates a control and allows control of the duration and opacity
 /// </summary>
 /// <param name="control">The control to be animated</param>
 /// <param name="opacity">The opacity value for the animation</param>
 /// <param name="duration">The duration for the animation</param>
 private void animateControlOpacity(Control control, double opacity, double duration)
 {
     control.BeginInit();
     control.Dispatcher.BeginInvoke((Action)(() =>
     {
         DoubleAnimation controlAnimation = new DoubleAnimation(opacity, new Duration(TimeSpan.FromSeconds(duration)));
         control.BeginAnimation(Label.OpacityProperty, controlAnimation);
     }), null);
     control.EndInit();
 }