Exemple #1
0
        /// <summary>
        /// Create the animation <see cref="Storyboard"/> that slides a <see cref="FrameworkElement"/> in from the left.
        /// </summary>
        /// <param name="element">The element to be animated.</param>
        /// <param name="seconds">Seconds the animation takes to complete.</param>
        /// <returns></returns>
        public static async Task SlideAndFadeInFromLeft(this FrameworkElement element, float seconds = 0.3f, bool keepMargin = true)
        {
            var storyboard = new Storyboard();

            storyboard.AddSlideFromLeft(seconds, element.ActualWidth, keepMargin: keepMargin);

            storyboard.AddFade(seconds, PageAnimation.FadeIn);

            storyboard.Begin(element);

            element.Visibility = Visibility.Visible;

            await Task.Delay((int)(seconds * 1000));
        }
Exemple #2
0
        /// <summary>
        /// Create the animation <see cref="Storyboard"/> that slides out to the left.
        /// </summary>
        /// <param name="page">The page to be animated.</param>
        /// <param name="seconds">Seconds the animation takes to complete.</param>
        /// <returns></returns>
        public static async Task SlideAndFadeOutToLeft(this Page page, float seconds)
        {
            var storyboard = new Storyboard();

            storyboard.AddSlideToLeft(seconds, page.WindowWidth);

            storyboard.AddFade(seconds, PageAnimation.FadeOut);

            storyboard.Begin(page);

            page.Visibility = Visibility.Visible;

            await Task.Delay((int)(seconds * 1000));
        }