Beispiel #1
0
        protected virtual void OnDecoratedElementChanged()
        {
            if (DecoratedElement == null)
            {
                this.ClearBinding(DecoratedCanvasTransformProperty);
                this.ClearBinding(DecoratedPresenterTransformProperty);
                this.ClearBinding(DecoratedPresenterTopProperty);
                this.ClearBinding(DecoratedPresenterLeftProperty);
            }
            else
            {
                var decoratedCanvas = DecoratedElement.FindAncestor <Canvas>();
                if (decoratedCanvas != null)
                {
                    this.SetBinding(DecoratedCanvasTransformProperty, decoratedCanvas, RenderTransformProperty);
                }

                var decoratedPresenter = DecoratedElement.FindAncestor <AnimatedContentPresenter>();
                if (decoratedPresenter != null)
                {
                    this.SetBinding(DecoratedPresenterTransformProperty, decoratedPresenter, RenderTransformProperty);
                    this.SetBinding(DecoratedPresenterTopProperty, decoratedPresenter, Canvas.TopProperty);
                    this.SetBinding(DecoratedPresenterLeftProperty, decoratedPresenter, Canvas.LeftProperty);
                }
            }
        }
Beispiel #2
0
        private Transform CreateRenderTransform()
        {
            var decoratedCanvas = DecoratedElement?.FindAncestor <Canvas>();

            if (decoratedCanvas == null)
            {
                return(Transform.Identity);
            }

            var transformFromDecoratedElementToCanvas = DecoratedElement.TransformToAncestor(decoratedCanvas) as Transform;

            if (transformFromDecoratedElementToCanvas == null)
            {
                return(Transform.Identity);
            }

            var transformGroup = new TransformGroup();

            transformGroup.Children.Add(transformFromDecoratedElementToCanvas);
            transformGroup.Children.Add(DecoratedCanvasTransform);
            return(transformGroup);
        }
        protected virtual void OnDecoratedElementChanged()
        {
            if (DecoratedElement == null)
            {
                this.ClearBinding(DecoratedCanvasTransformProperty);
                this.ClearBinding(DecoratedElementTransformProperty);
                this.ClearBinding(DecoratedElementTopProperty);
                this.ClearBinding(DecoratedElementLeftProperty);
            }
            else
            {
                var decoratedCanvas = DecoratedElement.FindAncestor <Canvas>();
                if (decoratedCanvas != null)
                {
                    this.SetBinding(DecoratedCanvasTransformProperty, decoratedCanvas, RenderTransformProperty);
                }

                this.SetBinding(DecoratedElementTransformProperty, DecoratedElement, RenderTransformProperty);
                this.SetBinding(DecoratedElementTopProperty, DecoratedElement, Canvas.TopProperty);
                this.SetBinding(DecoratedElementLeftProperty, DecoratedElement, Canvas.LeftProperty);
            }
        }