Exemplo n.º 1
1
        protected override FrameworkElement ModifyNewContent(ITransitionControl container, FrameworkElement newContent)
        {
            if (newContent == null)
            {
                HideBackground(container);
                container.Remove(_border);
                return null;
            }

            ShowBackground(container);

            _border = WrapInBorder(newContent);

            _border.Opacity = 0;

            SetPosition(_border);

            newContent.SizeChanged += (sender, e) => SetPosition(_border);

            var ctrl = container.AsControl();

            ctrl.SizeChanged += (sender, e) => SetPosition(_border);

            return _border;
        }
        protected override FrameworkElement ModifyNewContent(ITransitionControl container, FrameworkElement newContent)
        {
            var ctrl = container.AsControl();

            _leftStart = GetLeftStart(ctrl);
            _width = ctrl.ActualWidth;

            Canvas.SetLeft(newContent, _leftStart - _width);
            return newContent;
        }
        public void Transition(ITransitionControl container, FrameworkElement oldContent, FrameworkElement newContent)
        {
            FrameworkElement newContentToAdd = ModifyNewContent(container, newContent);

            container.Add(newContentToAdd);

            if (oldContent != null)
            {
                GetOutAnimation()
                    .UponCompletion(() => container.Remove(oldContent))
                    .AnimateOn(oldContent);
            }

            if (newContentToAdd != null)
            {
                GetInAnimation()
                    .AnimateOn(newContentToAdd);
            }
        }
Exemplo n.º 4
0
 void HideBackground(ITransitionControl container)
 {
     if (container.Contains(_background))
     {
         Animate.The(UIElement.OpacityProperty)
             .From(1d)
             .To(0d)
             .For(_duration)
             .UponCompletion(() => container.Remove(_background))
             .Create()
             .AnimateOn(_background);
     }
 }
Exemplo n.º 5
0
        void ShowBackground(ITransitionControl container)
        {
            if (!container.Contains(_background))
            {
                container.Add(_background);

                Animate.The(UIElement.OpacityProperty)
                    .From(0d)
                    .To(1d)
                    .For(_duration)
                    .Create()
                    .AnimateOn(_background);
            }
        }
Exemplo n.º 6
0
 protected override FrameworkElement ModifyNewContent(ITransitionControl container, FrameworkElement newContent)
 {
     newContent.Opacity = 0;
     return newContent;
 }
 protected virtual FrameworkElement ModifyNewContent(ITransitionControl container, FrameworkElement newContent)
 {
     return newContent;
 }