Inheritance: Timeline, IFadeInThemeAnimation
示例#1
0
        public static void FadeIn(UIElement element)
        {
            element.Visibility = Visibility.Visible;
            var fadeInStoryboard = new Storyboard();
            var fadeInAnimation = new FadeInThemeAnimation();

            Storyboard.SetTarget(fadeInAnimation, element);
            fadeInStoryboard.Children.Add(fadeInAnimation);
            fadeInStoryboard.Begin();
        }
        /// <summary>
        /// Fades the element in using the FadeInThemeAnimation.
        /// </summary>
        /// <remarks>
        /// Opacity property of the element is not affected.<br/>
        /// The duration of the visible animation itself is not affected by the duration parameter. It merely indicates how long the Storyboard will run.<br/>
        /// If FadeOutThemeAnimation was not used on the element before - nothing will happen.<br/>
        /// </remarks>
        /// <param name="element"></param>
        /// <param name="duration"></param>
        /// <returns></returns>
        public static async Task FadeIn(this UIElement element, TimeSpan? duration = null)
        {
            ((FrameworkElement)element).Visibility = Visibility.Visible;
            var fadeInStoryboard = new Storyboard();
            var fadeInAnimation = new FadeInThemeAnimation();

            if (duration != null)
            {
                fadeInAnimation.Duration = duration.Value;
            }

            Storyboard.SetTarget(fadeInAnimation, element);
            fadeInStoryboard.Children.Add(fadeInAnimation);
            await fadeInStoryboard.BeginAsync();
        } 
示例#3
0
        public TapGrid()
        {
            // Hide the control.
            this.Opacity = 0;

            // Down animation storyboard.
            var downAnim = new FadeInThemeAnimation
            {
                SpeedRatio = 5
            };
            Storyboard.SetTarget(downAnim, this);

            downStory = new Storyboard();
            downStory.Children.Add(downAnim);

            // Up animation storyboard.
            var upAnim = new FadeOutThemeAnimation
            {
                SpeedRatio = 0.5
            };
            Storyboard.SetTarget(upAnim, this);

            upStory = new Storyboard();
            upStory.Children.Add(upAnim);

            // Set event handlers.
            this.PointerPressed += (sender, e) =>
            {
                this.Opacity = 1;
                this.CapturePointer(e.Pointer);
                downStory.Begin();

                if (this.Command.CanExecute(null))
                {
                    this.Command.Execute(null);
                }
            };

            this.PointerReleased += (sender, e) =>
            {
                upStory.Begin();
                this.ReleasePointerCapture(e.Pointer);
            };
        }
 private void ShowGoToTopButton()
 {
     if (isHidden)
     {
         container.Visibility = Visibility.Visible;
         isHidden = false;
         var storyboard = new Storyboard();
         var animation = new FadeInThemeAnimation();
         animation.SetValue(Storyboard.TargetNameProperty, "ScrollToTopButton");
         Storyboard.SetTarget(animation, ScrollToTopButton);
         storyboard.Children.Add(animation);
         storyboard.Begin();
     }
 }
        private void SearchingFadeIn()
        {
            SearchingPanel.Visibility = Visibility.Visible;
            Storyboard sb = new Storyboard() { Duration = new Duration(TimeSpan.FromSeconds(0.5)) };

            FadeInThemeAnimation fadeAnim = new FadeInThemeAnimation() { Duration = new Duration(TimeSpan.FromSeconds(0.5)) };
            Storyboard.SetTarget(fadeAnim, SearchingPanel);
            sb.Children.Add(fadeAnim);

            sb.Completed += delegate
            {
                sb.Stop();
            };
            sb.Begin();
        }
        private void MoreBtn_Click(object sender, RoutedEventArgs e)
        {
            Storyboard sb = new Storyboard();

            FadeInThemeAnimation fadeInTimeline = new FadeInThemeAnimation();
            FadeInThemeAnimation fadeInClipData = new FadeInThemeAnimation();
            FadeInThemeAnimation fadeInVideoControls = new FadeInThemeAnimation();

            Storyboard.SetTarget(fadeInTimeline, timelineContainer as DependencyObject);
            Storyboard.SetTarget(fadeInClipData, ClipDataGrid as DependencyObject);
            Storyboard.SetTarget(fadeInVideoControls, VideoControls as DependencyObject);

            sb.Children.Add(fadeInTimeline);
            sb.Children.Add(fadeInClipData);
            sb.Children.Add(fadeInVideoControls);

            sb.Begin();

            MoreBtn.Visibility = Visibility.Collapsed;
            LessBtn.Visibility = Visibility.Visible;

            controlsFaded = false;
        }
        private void AppBarClosed(object sender, object e)
        {
            ClipDataGrid.Visibility = Windows.UI.Xaml.Visibility.Visible;

            ApplicationViewState currentViewState = ApplicationView.Value;

            if (timelineContainer == null)
            {
                try
                {
                    timelineContainer = (Grid)videoMediaElement.ControlPanel.GetDescendantsOfType<Grid>().ElementAt(2);
                }
                catch { }
            }

            try
            {
                Storyboard sb = new Storyboard();

                RepositionThemeAnimation repositionTimelineAnimation = new RepositionThemeAnimation();
                RepositionThemeAnimation repositionBtnAnimation = new RepositionThemeAnimation();
                FadeInThemeAnimation fadeInAnimation = new FadeInThemeAnimation();
                FadeInThemeAnimation fadeInBtn = new FadeInThemeAnimation();

                Storyboard.SetTarget(fadeInAnimation, ClipDataGrid as DependencyObject);
                Storyboard.SetTarget(fadeInBtn, LessBtn as DependencyObject);

                Storyboard.SetTarget(repositionTimelineAnimation, timelineContainer as DependencyObject);
                repositionTimelineAnimation.FromVerticalOffset = -204;

                Storyboard.SetTarget(repositionBtnAnimation, LessBtn as DependencyObject);
                repositionBtnAnimation.FromVerticalOffset = -204;

                sb.Children.Add(repositionTimelineAnimation);
                sb.Children.Add(repositionBtnAnimation);
                sb.Children.Add(fadeInAnimation);
                sb.Children.Add(fadeInBtn);

                timelineContainer.Margin = new Thickness(0);
                LessBtn.Margin = new Thickness(0);

                sb.Begin();
            }
            catch { }
        }