Matrix Object

Represents a 3x3 affine transformation matrix used for transformations in 2-D space.

XAML
<Matrix ... />
Scripting
To create an object using scripting, see CreateFromXAML.

Properties

M11, M12, M21, M22, Name, OffsetX, OffsetY

Methods

Equals, FindName, GetHost, GetValue, SetValue

Remarks

Properties of a Matrix are animatable (as one or more DoubleAnimations or DoubleAnimationUsingKeyFrames).

A Matrix provides the property value for the MatrixTransform.Matrix property. Often, it is more practical to manipulate the transforms by using one of the other transform objects and properties that constrain the transform into a particular type. These are RotateTransform, ScaleTransform, SkewTransform, and TranslateTransform.

Examples

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

XAML
<Canvas
  xmlns="https://schemas.microsoft.com/client/2007"
  xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml"
  Width="400" Height="300">
  <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>
</Canvas>

See Also

Silverlight Transforms Overview
Transform