Export (0) Print
Expand All

CompositeTransform Class

Silverlight

This class lets you apply multiple different transforms to an object.

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)

public sealed class CompositeTransform : Transform
<CompositeTransform .../>

The CompositeTransform type exposes the following members.

  NameDescription
Public methodSupported by Silverlight for Windows PhoneCompositeTransformInitializes a new instance of the CompositeTransform class.
Top

  NameDescription
Public propertySupported by Silverlight for Windows PhoneCenterXGets or sets the x-coordinate of the center point for all transforms specified by the CompositeTransform.
Public propertySupported by Silverlight for Windows PhoneCenterYGets or sets the y-coordinate of the center point for all transforms specified by the CompositeTransform.
Public propertySupported by Silverlight for Windows PhoneDispatcherGets the Dispatcher this object is associated with. (Inherited from DependencyObject.)
Public propertySupported by Silverlight for Windows PhoneInverseGets the inverse of this transform, if it exists. (Inherited from Transform.)
Public propertySupported by Silverlight for Windows PhoneRotationGets or sets the angle, in degrees, of clockwise rotation.
Public propertySupported by Silverlight for Windows PhoneScaleXGets or sets the x-axis scale factor. You can use this property to stretch or shrink an object horizontally.
Public propertySupported by Silverlight for Windows PhoneScaleYGets or sets the y-axis scale factor. You can use this property to stretch or shrink an object vertically.
Public propertySupported by Silverlight for Windows PhoneSkewXGets or sets the x-axis skew angle, which is measured in degrees counterclockwise from the y-axis. A skew transform can be useful for creating the illusion of three-dimensional depth in a two-dimensional object.
Public propertySupported by Silverlight for Windows PhoneSkewYGets or sets the y-axis skew angle, which is measured in degrees counterclockwise from the x-axis. A skew transform can be useful for creating the illusion of three-dimensional depth in a two-dimensional object.
Public propertySupported by Silverlight for Windows PhoneTranslateXGets or sets the distance to translate along the x-axis.
Public propertySupported by Silverlight for Windows PhoneTranslateYGets or sets the distance to translate (move) an object along the y-axis.
Top

  NameDescription
Public methodSupported by Silverlight for Windows PhoneCheckAccessDetermines whether the calling thread has access to this object. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneClearValueClears the local value of a dependency property. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodSupported by Silverlight for Windows PhoneFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetAnimationBaseValueReturns any base value established for a Silverlight dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneGetValueReturns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.)
Protected methodSupported by Silverlight for Windows PhoneMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneReadLocalValueReturns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneSetValueSets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.)
Public methodSupported by Silverlight for Windows PhoneToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodSupported by Silverlight for Windows PhoneTransformTransforms the specified point and returns the result. (Inherited from GeneralTransform.)
Public methodSupported by Silverlight for Windows PhoneTransformBoundsTransforms the specified bounding box and returns an axis-aligned bounding box that is exactly large enough to contain it. (Inherited from Transform.)
Public methodSupported by Silverlight for Windows PhoneTryTransformAttempts to transform the specified point and returns a value that indicates whether the transformation was successful. (Inherited from Transform.)
Top

  NameDescription
Public fieldStatic memberSupported by Silverlight for Windows PhoneCenterXPropertyIdentifies the CenterX dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneCenterYPropertyIdentifies the CenterY dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneRotationPropertyIdentifies the Rotation dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneScaleXPropertyIdentifies the ScaleX dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneScaleYPropertyIdentifies the ScaleY dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneSkewXPropertyIdentifies the SkewX dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneSkewYPropertyIdentifies the SkewY dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneTranslateXPropertyIdentifies the TranslateX dependency property.
Public fieldStatic memberSupported by Silverlight for Windows PhoneTranslateYPropertyIdentifies the TranslateY dependency property.
Top

Instead of applying transforms to an object by using individual transform objects in a TransformGroup (for example, ScaleTransform or SkewTransform), you can use a single instance of the CompositeTransform object to apply all these basic transforms (see the example below). This enables you to make your XAML code more concise. In addition, CompositeTransform applies multiple transforms in the following recommended order:

  1. Scale

  2. Skew

  3. Rotate

  4. Translate

If, for whatever reason, you want to apply multiple transforms to an object in a different order than is recommended here, you can use the TransformGroup to do this. The TransformGroup is also useful if you want to specify different center points for the various transforms you apply. For example, the CenterX and CenterY properties on the CompositeTransform is applied to all transforms of the CompositeTransform while you can specify different center points for ScaleTransform, SkewTransform, and RotateTransform within a TransformGroup.

The following example shows how to apply the same transforms to an object by using either a TransformGroup or a TransformGroup.

Run this sample


<StackPanel Margin="50">
    <Canvas Background="Black" Width="200" Height="200">
        <Rectangle Height="100" Width="100" Fill="Red">
          <Rectangle.RenderTransform>

            <!-- This one line of markup is the equivalent of the entire
                 TransformGroup block in the other Canvas below. -->
            <CompositeTransform SkewX="30" Rotation="45" ScaleX="0.8" ScaleY="0.8" />
        </Rectangle.RenderTransform>
    </Rectangle>
    </Canvas>

    <Canvas Margin="10" Background="Black" Width="200" Height="200">
        <Rectangle Height="100" Width="100" Fill="Red">
            <Rectangle.RenderTransform>
                <TransformGroup>

                    <!-- Note that you have to apply these transforms in 
                         a specific order to get the same effect as the
                         CompositeTransform. -->
                    <ScaleTransform ScaleX="0.8" ScaleY="0.8" />
                    <SkewTransform AngleX="30" />
                    <RotateTransform Angle="45" /> 
                </TransformGroup>
            </Rectangle.RenderTransform>
        </Rectangle>
    </Canvas>
</StackPanel>


Silverlight

Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft