예제 #1
0
        /// <summary>
        /// Fades background from pointed color to pointed color
        /// </summary>
        /// <param name="checkBox">The CheckBox to animate</param>
        /// <param name="seconds">The time the animation will take</param>
        /// <returns></returns>
        public static async Task BackgroundColorFade(this CheckBox checkBox,
                                                     Color colorFrom,
                                                     Color colorTo,
                                                     float seconds)
        {
            // Create the storyboard
            Storyboard s = new Storyboard();

            // Add color fade animation
            s.AddBackgroundColorFade(checkBox, colorFrom, colorTo, seconds);

            // Start animating
            s.Begin();

            // Wait for it to finish
            await Task.Delay((int)(seconds * 1000));
        }