TransformGroup

The TransformGroup represents a composite Transform composed of other Transform objects. Typically these are the Silverlight defined classes RotateTransform, ScaleTransform, SkewTransform, TranslateTransform, MatrixTransform, or TransformGroup. Object elements defined here become members of the TransformCollection collection when code accesses the Children property at run time.

Use a TransformGroup when you want to apply multiple Transform operations to a single object.

In a composite transformation, the order of individual transformations is important. For example, if you first rotate, then scale, then translate, you get a different result than if you first translate, then rotate, then scale. One reason order is significant is that transformations like rotation and scaling are done with respect to the origin of the coordinate system. Scaling an object that is centered at the origin produces a different result than scaling an object that has been moved away from the origin. Similarly, rotating an object that is centered at the origin produces a different result than rotating an object that has been moved away from the origin.

In XAML usages, TransformGroup uses Children as its content property and supports implicit collection usage. Therefore, to declare transforms that will be in a TransformGroup in XAML, you declare one or more transforms as object elements, placing them in order as the child elements of the TransformGroup. Nesting more than one TransformGroup is permitted.

For example:

<c1:C1LayoutTransformer >

    <c1:C1LayoutTransformer.LayoutTransform>

        <TransformGroup>

            <ScaleTransform ScaleX="0.8" ScaleY="0.8" />

            <SkewTransform AngleX="30" />

            <RotateTransform Angle="45" />

        </TransformGroup>

    </c1:C1LayoutTransformer.LayoutTransform>

    <Button Background="OrangeRed" Content="Group" Height="80" Width="180" VerticalAlignment="Bottom" HorizontalAlignment="Left"/>

</c1:C1LayoutTransformer>


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.