Skip to main content
.NET Framework Class Library
TransformGroup Class

Represents a composite Transform composed of other Transform objects.

Namespace:   System.Windows.Media
Assembly:  PresentationCore (in PresentationCore.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Syntax
<[%$TOPIC/ms635598_en-us_VS_110_4_0_0_0_0%]("Children")> _
Public NotInheritable Class TransformGroup _
	Inherits [%$TOPIC/ms635598_en-us_VS_110_4_0_0_0_1%]
[[%$TOPIC/ms635598_en-us_VS_110_4_0_1_0_0%]("Children")]
public sealed class TransformGroup : [%$TOPIC/ms635598_en-us_VS_110_4_0_1_0_1%]
[[%$TOPIC/ms635598_en-us_VS_110_4_0_2_0_0%](L"Children")]
public ref class TransformGroup sealed : public [%$TOPIC/ms635598_en-us_VS_110_4_0_2_0_1%]
[<[%$TOPIC/ms635598_en-us_VS_110_4_0_3_0_0%]>]
[<[%$TOPIC/ms635598_en-us_VS_110_4_0_3_0_1%]("Children")>]
type TransformGroup =  
    class 
        inherit [%$TOPIC/ms635598_en-us_VS_110_4_0_3_0_2%] 
    end
<TransformGroup>
  [%$TOPIC/ms635598_en-us_VS_110_4_0_4_0_0%]
</TransformGroup>

The TransformGroup type exposes the following members.

Constructors
  NameDescription
Public method TransformGroupInitializes a new instance of the TransformGroup class.
Top
Properties
  NameDescription
Public property CanFreezeGets a value that indicates whether the object can be made unmodifiable. (Inherited from Freezable.)
Public property ChildrenGets or sets the TransformCollection that defines this TransformGroup.
Public property DependencyObjectTypeGets the DependencyObjectType that wraps the CLR type of this instance.  (Inherited from DependencyObject.)
Public property DispatcherGets the Dispatcher this DispatcherObject is associated with. (Inherited from DispatcherObject.)
Public property HasAnimatedPropertiesGets a value that indicates whether one or more AnimationClock objects is associated with any of this object's dependency properties. (Inherited from Animatable.)
Public property InverseGets the inverse of this transform, if it exists. (Inherited from Transform.)
Public property IsFrozenGets a value that indicates whether the object is currently modifiable. (Inherited from Freezable.)
Public property IsSealedGets a value that indicates whether this instance is currently sealed (read-only). (Inherited from DependencyObject.)
Public property ValueGets the Matrix structure that describes the transformation represented by this TransformGroup. (Overrides TransformValue.)
Top
Methods
  NameDescription
Public method ApplyAnimationClock(DependencyProperty, AnimationClock)Applies an AnimationClock to the specified DependencyProperty. If the property is already animated, the SnapshotAndReplace handoff behavior is used. (Inherited from Animatable.)
Public method ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)Applies an AnimationClock to the specified DependencyProperty. If the property is already animated, the specified HandoffBehavior is used. (Inherited from Animatable.)
Public method BeginAnimation(DependencyProperty, AnimationTimeline)Applies an animation to the specified DependencyProperty. The animation is started when the next frame is rendered. If the specified property is already animated, the SnapshotAndReplace handoff behavior is used. (Inherited from Animatable.)
Public method BeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior)Applies an animation to the specified DependencyProperty. The animation is started when the next frame is rendered. If the specified property is already animated, the specified HandoffBehavior is used. (Inherited from Animatable.)
Public method CheckAccessDetermines whether the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject.)
Public method ClearValue(DependencyProperty)Clears the local value of a property. The property to be cleared is specified by a DependencyProperty identifier. (Inherited from DependencyObject.)
Public method ClearValue(DependencyPropertyKey)Clears the local value of a read-only property. The property to be cleared is specified by a DependencyPropertyKey. (Inherited from DependencyObject.)
Public method CloneCreates a modifiable copy of this TransformGroup by making deep copies of its values.
Public method CloneCurrentValueCreates a modifiable copy of this TransformGroup object by making deep copies of its values. This method does not copy resource references, data bindings, or animations, although it does copy their current values.
Public method CoerceValueCoerces the value of the specified dependency property. This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject. (Inherited from DependencyObject.)
Public method EqualsDetermines whether a provided DependencyObject is equivalent to the current DependencyObject. (Inherited from DependencyObject.)
Public method FreezeMakes the current object unmodifiable and sets its IsFrozen property to true. (Inherited from Freezable.)
Public method GetAnimationBaseValueReturns the non-animated value of the specified DependencyProperty. (Inherited from Animatable.)
Public method GetAsFrozenCreates a frozen copy of the Freezable, using base (non-animated) property values. Because the copy is frozen, any frozen sub-objects are copied by reference. (Inherited from Freezable.)
Public method GetCurrentValueAsFrozenCreates a frozen copy of the Freezable using current property values. Because the copy is frozen, any frozen sub-objects are copied by reference. (Inherited from Freezable.)
Public method GetHashCodeGets a hash code for this DependencyObject. (Inherited from DependencyObject.)
Public method GetLocalValueEnumeratorCreates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject. (Inherited from DependencyObject.)
Public method GetTypeGets the Type of the current instance. (Inherited from Object.)
Public method GetValueReturns the current effective value of a dependency property on this instance of a DependencyObject. (Inherited from DependencyObject.)
Public method InvalidatePropertyRe-evaluates the effective value for the specified dependency property (Inherited from DependencyObject.)
Public method ReadLocalValueReturns the local value of a dependency property, if it exists. (Inherited from DependencyObject.)
Public method SetCurrentValueSets the value of a dependency property without changing its value source. (Inherited from DependencyObject.)
Public method SetValue(DependencyProperty, Object)Sets the local value of a dependency property, specified by its dependency property identifier. (Inherited from DependencyObject.)
Public method SetValue(DependencyPropertyKey, Object)Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property. (Inherited from DependencyObject.)
Protected method ShouldSerializePropertyReturns a value that indicates whether serialization processes should serialize the value for the provided dependency property. (Inherited from DependencyObject.)
Public method ToStringCreates a string representation of this GeneralTransform. (Inherited from GeneralTransform.)
Public method ToString(IFormatProvider)Creates a string representation of this instance, based on the passed IFormatProvider parameter. (Inherited from GeneralTransform.)
Public method TransformTransforms the specified point and returns the result. (Inherited from GeneralTransform.)
Public method TransformBoundsTransforms the specified bounding box and returns an axis-aligned bounding box that is exactly large enough to contain it. (Inherited from Transform.)
Public method TryTransformAttempts to transform the specified point and returns a value that indicates whether the transformation was successful. (Inherited from Transform.)
Public method VerifyAccessEnforces that the calling thread has access to this DispatcherObject. (Inherited from DispatcherObject.)
Top
Events
  NameDescription
Public event ChangedOccurs when the Freezable or an object it contains is modified. (Inherited from Freezable.)
Top
Fields
  NameDescription
Public field Static member ChildrenPropertyIdentifies the Children dependency property.
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implemetation Private method IFormattableToStringFormats the value of the current instance using the specified format. (Inherited from GeneralTransform.)
Top
Remarks

Use a TransformGroup when you want to apply multiple Transform objects to a single property.

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.

Freezable Features: Because it inherits from the Freezable class, the TransformGroup class provides several special features: TransformGroup objects can be declared as resources, shared among multiple objects, made read-only to improve performance, cloned, and made thread-safe. For more information about the different features provided by Freezable objects, see Freezable Objects Overview.

Examples

This example shows how to use a TransformGroup to group two or more Transform objects into a single composite Transform.

The following example uses a TransformGroup to apply a ScaleTransform and a RotateTransform to a Button.

<Page 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
  <StackPanel Margin="50">

      <Button 
        RenderTransformOrigin="0.5,0.5"
        HorizontalAlignment="Center">Click
        <Button.RenderTransform>

          <!-- TransformGroup enables you to apply multiple transforms. In 
               this example, the button is scaled and rotated. -->
          <TransformGroup>

            <!-- Triple the size (scale) of the button in the Y direction. -->
            <ScaleTransform ScaleY="3" />

            <!-- Rotate the button by 45 degrees. -->
            <RotateTransform Angle="45" />

          </TransformGroup>
        </Button.RenderTransform>
      </Button>

  </StackPanel>
</Page>

Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Media

Namespace SDKSample
	Partial Public Class MultipleTransformsExample
		Inherits Page
		Public Sub New()
			' Create a Button that will have two transforms applied to it.
			Dim myButton As New Button()
			myButton.Content = "Click"

			' Set the center point of the transforms.
			myButton.RenderTransformOrigin = New Point(0.5,0.5)

			' Create a transform to scale the size of the button.
			Dim myScaleTransform As New ScaleTransform()

			' Set the transform to triple the scale in the Y direction.
			myScaleTransform.ScaleY = 3

			' Create a transform to rotate the button
			Dim myRotateTransform As New RotateTransform()

			' Set the rotation of the transform to 45 degrees.
			myRotateTransform.Angle = 45

			' Create a TransformGroup to contain the transforms
			' and add the transforms to it.
			Dim myTransformGroup As New TransformGroup()
			myTransformGroup.Children.Add(myScaleTransform)
			myTransformGroup.Children.Add(myRotateTransform)

			' Associate the transforms to the button.
			myButton.RenderTransform = myTransformGroup

			' Create a StackPanel which will contain the Button.
			Dim myStackPanel As New StackPanel()
			myStackPanel.Margin = New Thickness(50)
			myStackPanel.Children.Add(myButton)
			Me.Content = myStackPanel

		End Sub
	End Class
End Namespace
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;

namespace SDKSample
{
    public partial class MultipleTransformsExample : Page
    {
        public MultipleTransformsExample()
        {
            // Create a Button that will have two transforms applied to it.
            Button myButton = new Button();
            myButton.Content = "Click";

            // Set the center point of the transforms.
            myButton.RenderTransformOrigin = new Point(0.5,0.5);

            // Create a transform to scale the size of the button.
            ScaleTransform myScaleTransform = new ScaleTransform();

            // Set the transform to triple the scale in the Y direction.
            myScaleTransform.ScaleY = 3;

            // Create a transform to rotate the button
            RotateTransform myRotateTransform = new RotateTransform();

            // Set the rotation of the transform to 45 degrees.
            myRotateTransform.Angle = 45;

            // Create a TransformGroup to contain the transforms 
            // and add the transforms to it.
            TransformGroup myTransformGroup = new TransformGroup();
            myTransformGroup.Children.Add(myScaleTransform);
            myTransformGroup.Children.Add(myRotateTransform);

            // Associate the transforms to the button.
            myButton.RenderTransform = myTransformGroup;

            // Create a StackPanel which will contain the Button.
            StackPanel myStackPanel = new StackPanel();
            myStackPanel.Margin = new Thickness(50);
            myStackPanel.Children.Add(myButton);
            this.Content = myStackPanel;

        }
    }
}
Version Information

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Platforms

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

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