Exemplo n.º 1
0
        public CompositeTransform()
        {
            var scaleTransform     = new ScaleTransform();
            var rotateTransform    = new RotateTransform();
            var translateTransform = new TranslateTransform();
            var skewTransform      = new SkewTransform();

            scaleTransform.BindProperties(ScaleTransform.CenterXProperty, this, CenterXProperty);
            scaleTransform.BindProperties(ScaleTransform.CenterYProperty, this, CenterYProperty);
            scaleTransform.BindProperties(ScaleTransform.ScaleXProperty, this, ScaleXProperty);
            scaleTransform.BindProperties(ScaleTransform.ScaleYProperty, this, ScaleYProperty);

            rotateTransform.BindProperties(RotateTransform.CenterXProperty, this, CenterXProperty);
            rotateTransform.BindProperties(RotateTransform.CenterYProperty, this, CenterYProperty);
            rotateTransform.BindProperties(RotateTransform.AngleProperty, this, RotationProperty);

            translateTransform.BindProperties(TranslateTransform.XProperty, this, TranslateXProperty);
            translateTransform.BindProperties(TranslateTransform.YProperty, this, TranslateYProperty);

            skewTransform.BindProperties(SkewTransform.CenterXProperty, this, CenterXProperty);
            skewTransform.BindProperties(SkewTransform.CenterYProperty, this, CenterYProperty);
            skewTransform.BindProperties(SkewTransform.AngleXProperty, this, SkewXProperty);
            skewTransform.BindProperties(SkewTransform.AngleYProperty, this, SkewYProperty);

            _transform = new TransformGroup
            {
                Children =
                {
                    scaleTransform,
                    skewTransform,
                    rotateTransform,
                    translateTransform
                }
            };
        }