Exemple #1
0
        private void AnimateFadeOut(UIElement element)
        {
            var s           = new Storyboard();
            var animOpacity = AnimationUtils.CreateAnimation(0);

            Storyboard.SetTarget(animOpacity, element);
            Storyboard.SetTargetProperty(animOpacity, new PropertyPath("Opacity"));
            s.Children.Add(animOpacity);

            s.Completed += (s1, e1) => {
                hostGrid.Children.Remove(element);
            };

            BeginStoryboard(s);
        }
Exemple #2
0
        private void AnimateFadeIn(UIElement element)
        {
            var s           = new Storyboard();
            var animOpacity = AnimationUtils.CreateAnimation(0, 1, 2000);

            Storyboard.SetTarget(animOpacity, element);
            Storyboard.SetTargetProperty(animOpacity, new PropertyPath("Opacity"));
            s.Children.Add(animOpacity);

            var animSlide = AnimationUtils.CreateAnimation(0, 100, 2000);

            Storyboard.SetTarget(animSlide, element.RenderTransform);
            Storyboard.SetTargetProperty(animSlide, new PropertyPath("X"));
            s.Children.Add(animSlide);

            BeginStoryboard(s);
        }