Beispiel #1
0
        private void SetupTileViewAnimator(TransitionAnimationProvider animator)
        {
            if (!IsLoaded || animator == null)
            {
                return;
            }

            animator.Bind(TransitionAnimationProvider.DurationProperty, this, AnimationDurationProperty);

            var threeDRect = GetTemplateChild("ThreeDRectangle") as Rectangle2D3D;

            if (threeDRect == null)
            {
                threeDRect = this.GetFirstDescendent <Rectangle2D3D>();
            }

            var threeDAnimator = animator as TransitionAnimation3DProvider;

            if (threeDAnimator != null)
            {
                if (threeDRect != null)
                {
                    threeDAnimator.Container = threeDRect;
                }
                else
                {
                    threeDAnimator.Container = this.GetFirstDescendent <Panel>();
                }
            }
            else
            {
                if (threeDRect != null)
                {
                    animator.Container = threeDRect.Parent as Panel;
                }
                if (animator.Container == null)
                {
                    animator.Container = this.GetFirstDescendent <Panel>();
                }
            }

            animator.Initialize();
            animator.LeavingViewCompleted  += TileViewAnimator_LeavingViewCompleted;
            animator.EnteringViewCompleted += TileViewAnimator_EnteringViewCompleted;
        }
Beispiel #2
0
        private void SetupMetroAppAnimator(TransitionAnimationProvider animator)
        {
            if (animator == null || _ParentShell == null)
            {
                return;
            }

            animator.Bind(TransitionAnimationProvider.DurationProperty, this, AnimationDurationProperty);

            // Metro app here is basically MetroShell. It is content of MetroShell which is being animated.
            // The animation logic has been located here in order to keep all animation properties
            // with MetroStartControl and because without MetroStartControl there would be no need to
            // animate MetroShell content.
            var threeDAnimator = animator as TransitionAnimation3DProvider;

            if (threeDAnimator != null)
            {
                var threeDRectangle = _ParentShell.GetFirstDescendent <Rectangle2D3D>();
                if (threeDRectangle != null)
                {
                    threeDAnimator.Container = threeDRectangle;
                }
                else
                {
                    threeDAnimator.Container = _ParentShell.GetFirstDescendent <Grid>();
                }
            }
            else
            {
                animator.Container = _ParentShell.GetFirstDescendent <Grid>();
            }

            animator.Initialize();
            animator.LeavingViewCompleted  += MetroAppAnimator_LeavingViewCompleted;
            animator.EnteringViewCompleted += MetroAppAnimator_EnteringViewCompleted;
        }