Esempio n. 1
0
 protected internal override void BeginTransition(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent)
 {
     DoubleAnimation da = new DoubleAnimation(0, Duration);
     da.Completed += delegate
     {
         EndTransition(transitionElement, oldContent, newContent);
     };
     oldContent.BeginAnimation(UIElement.OpacityProperty, da);
 }
        protected internal override void BeginTransition(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent)
        {
            Storyboard oldStoryboard = OldContentStoryboard;
            Storyboard newStoryboard = NewContentStoryboard;

            if (oldStoryboard != null || newStoryboard != null)
            {
                oldContent.Style = OldContentStyle;
                newContent.Style = NewContentStyle;

                // Flag to determine when both storyboards are done
                bool done = oldStoryboard == null || newStoryboard == null;

                if (oldStoryboard != null)
                {
                    oldStoryboard = oldStoryboard.Clone();
                    oldContent.SetValue(OldContentStoryboardProperty, oldStoryboard);
                    oldStoryboard.Completed += delegate
                    {
                        if (done)
                            EndTransition(transitionElement, oldContent, newContent);
                        done = true;
                    };
                    oldStoryboard.Begin(oldContent, true);
                }

                if (newStoryboard != null)
                {
                    newStoryboard = newStoryboard.Clone();
                    newContent.SetValue(NewContentStoryboardProperty, newStoryboard);
                    newStoryboard.Completed += delegate
                    {
                        if (done)
                            EndTransition(transitionElement, oldContent, newContent);
                        done = true;
                    };
                    newStoryboard.Begin(newContent, true);
                }
            }
            else
            {
                EndTransition(transitionElement, oldContent, newContent);
            }
        }
 protected override void OnTransitionEnded(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent)
 {
     newContent.ClearValue(ContentPresenter.RenderTransformProperty);
     oldContent.ClearValue(ContentPresenter.RenderTransformProperty);
 }
Esempio n. 4
0
 protected override void OnTransitionEnded(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent)
 {
     oldContent.BeginAnimation(UIElement.OpacityProperty, null);
 }
Esempio n. 5
0
 //Transitions can override this to perform cleanup at the end of the transition
 protected virtual void OnTransitionEnded(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent)
 {
 }
Esempio n. 6
0
        //Transitions should call this method when they are done
        protected void EndTransition(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent)
        {
            OnTransitionEnded(transitionElement, oldContent, newContent);

            transitionElement.OnTransitionCompleted();
        }
Esempio n. 7
0
 // Called when an element is Removed from the TransitionPresenter's visual tree
 protected internal virtual void BeginTransition(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent)
 {
     EndTransition(transitionElement, oldContent, newContent);
 }
        protected override void OnTransitionEnded(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent)
        {
            Storyboard oldStoryboard = (Storyboard)oldContent.GetValue(OldContentStoryboardProperty);
            if (oldStoryboard != null)
                oldStoryboard.Stop(oldContent);
            oldContent.ClearValue(ContentPresenter.StyleProperty);

            Storyboard newStoryboard = (Storyboard)newContent.GetValue(NewContentStoryboardProperty);
            if (newStoryboard != null)
                newStoryboard.Stop(newContent);
            newContent.ClearValue(ContentPresenter.StyleProperty);
        }
        protected internal override void BeginTransition(TransitionPresenter transitionElement, ContentPresenter oldContent, ContentPresenter newContent)
        {
            TranslateTransform tt = new TranslateTransform(StartPoint.X * transitionElement.ActualWidth, StartPoint.Y * transitionElement.ActualHeight);

            if (IsNewContentTopmost)
                newContent.RenderTransform = tt;
            else
                oldContent.RenderTransform = tt;

            DoubleAnimation da = new DoubleAnimation(EndPoint.X * transitionElement.ActualWidth, Duration);
            tt.BeginAnimation(TranslateTransform.XProperty, da);

            da.To = EndPoint.Y * transitionElement.ActualHeight;
            da.Completed += delegate
            {
                EndTransition(transitionElement, oldContent, newContent);
            };
            tt.BeginAnimation(TranslateTransform.YProperty, da);
        }