Create Shape Fill Transition - CSharp Windows.UI.Xaml.Media.Animation

CSharp examples for Windows.UI.Xaml.Media.Animation:Animation

Description

Create Shape Fill Transition

Demo Code


using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml;
using Windows.UI;
using System;/*from   ww  w .j a  va2 s. c  om*/

public class Main{
        public static Storyboard CreateShapeFillTransition(UIElement uiElement, TimeSpan beginTime, TimeSpan duration, Color toColor)
        {
            var colorAnimation = new ColorAnimation
            {
                BeginTime = beginTime,
                Duration = duration,
                To = toColor,
            };

            Storyboard.SetTarget(colorAnimation, uiElement);
            Storyboard.SetTargetProperty(colorAnimation, "(UIElement.Fill).(SolidColorBrush.Color)");

            var sb = new Storyboard();
            sb.Children.Add(colorAnimation);
            return sb;
        }
}

Related Tutorials