Пример #1
0
        void FadeLabel_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            FadeLabel  RegionLabel          = this;
            var        changeColorAnimation = new ColorAnimation(Color.FromRgb(HoverColor, HoverColor, HoverColor), TimeSpan.FromSeconds(0.5));
            Storyboard s = new Storyboard();

            s.Duration = new Duration(new TimeSpan(0, 0, 1));
            s.Children.Add(changeColorAnimation);
            Storyboard.SetTarget(changeColorAnimation, RegionLabel);
            Storyboard.SetTargetProperty(changeColorAnimation, new PropertyPath("Foreground.Color"));
            s.Begin();
        }
Пример #2
0
        public void FadeOut()
        {
            FadeLabel  FadeLabel            = this;
            var        changeColorAnimation = new ColorAnimation(Color.FromRgb(NoHoverColor, NoHoverColor, NoHoverColor), TimeSpan.FromSeconds(0.5));
            Storyboard s = new Storyboard();

            s.Duration = new Duration(new TimeSpan(0, 0, 1));
            s.Children.Add(changeColorAnimation);
            Storyboard.SetTarget(changeColorAnimation, FadeLabel);
            Storyboard.SetTargetProperty(changeColorAnimation, new PropertyPath("Foreground.Color"));
            s.Begin();
        }