MatrixTransform Class
TOC
Collapse the table of content
Expand the table of content

MatrixTransform Class

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Creates an arbitrary affine matrix transformation that is used to manipulate objects or coordinate systems in a two-dimensional plane.

System::Object
  System.Windows::DependencyObject
    System.Windows.Media::GeneralTransform
      System.Windows.Media::Transform
        System.Windows.Media::MatrixTransform

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.

No code example is currently available or this language may not be supported.
<MatrixTransform .../>
<object property="m11, m12, m21, m22, offsetX, offsetY"/>
- or -
<object property="Identity"/>

XAML Values

m11

The value at position (1, 1) of the transformation Matrix.

m12

The value at position (1, 2) of the transformation Matrix.

m21

The value at position (2, 1) of the transformation Matrix.

m22

The value at position (2, 2) of the transformation Matrix.

offsetX

The value at position (3, 1) of the transformation Matrix.

offsetY

The value at position (3, 2) of the transformation Matrix.

The MatrixTransform type exposes the following members.

  NameDescription
Public methodMatrixTransformInitializes a new instance of the MatrixTransform class.
Top

  NameDescription
Public propertyDispatcherGets the Dispatcher this object is associated with. (Inherited from DependencyObject.)
Public propertyInverseGets the inverse of this transform, if it exists. (Inherited from Transform.)
Public propertyMatrixGets or sets the Matrix that defines this transformation.
Top

  NameDescription
Public methodCheckAccessDetermines whether the calling thread has access to this object. (Inherited from DependencyObject.)
Public methodClearValueClears the local value of a dependency property. (Inherited from DependencyObject.)
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetAnimationBaseValueReturns any base value established for a Windows Phone dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodGetValueReturns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodReadLocalValueReturns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.)
Public methodSetValueSets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Public methodTransformTransforms the specified point and returns the result. (Inherited from GeneralTransform.)
Public methodTransformBoundsTransforms the specified bounding box and returns an axis-aligned bounding box that is exactly large enough to contain it. (Inherited from Transform.)
Public methodTryTransformAttempts to transform the specified point and returns a value that indicates whether the transformation was successful. (Inherited from Transform.)
Top

  NameDescription
Public fieldStatic memberMatrixPropertyIdentifies the Matrix dependency property.
Top

Use a MatrixTransform to create custom transformations that are not provided by the RotateTransform, ScaleTransform, SkewTransform, and TranslateTransform classes.

A two-dimensional x-y plane uses a 3 x 3 matrix for transformations. You can multiply affine matrix transformations to form linear transformations, such as rotation and skew (shear) transformations that are followed by translation.

An affine matrix transformation has its final column equal to (0, 0, 1); therefore, you only have to specify the members in the first two columns.

The members in the last row, OffsetX and OffsetY, represent translation values.

Methods and properties usually specify the transformation matrix as a vector that has only six members; the members are as follows:

    (M11, M12, M21, M22, OffsetX, OffsetY)

You can offset the local (0,0) position for an object on a Canvas by using the Canvas::Left and Canvas::Top properties, but this does not operate as a transform; the object retains its own local (0,0) position in this case for transform purposes. For details on this concept, see Layout and panels for Windows Phone.

Multiple transforms can be applied with a TransformGroup.

The following example transforms the position and skew of a rectangle using a MatrixTransform.


<Rectangle Width="60" Height="60" Fill="Blue">
  <Rectangle.RenderTransform>
    <MatrixTransform>
      <MatrixTransform.Matrix >

        <!-- This matrix transforms the x,y position of
             the rectangle and skews it. -->
        <Matrix OffsetX="30" OffsetY="100" M12="0.5" />
      </MatrixTransform.Matrix>
    </MatrixTransform>
  </Rectangle.RenderTransform>

</Rectangle>


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

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

Show:
© 2017 Microsoft