Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Matrix Property
Collapse the table of content
Expand the table of content

MatrixTransform.Matrix Property

Gets or sets the Matrix structure that defines this transformation.

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

public Matrix Matrix { get; set; }
<object>
  <object.Matrix>
    <Matrix .../>
  </object.Matrix>
</object>
<object Matrix="Matrix" .../>

Property Value

Type: System.Windows.Media.Matrix
The Matrix structure that defines this transformation. The default value is an identity Matrix. An identity matrix has a value of 1 in coefficients [1,1], [2,2], and [3,3]; and a value of 0 in the rest of the coefficients.

Identifier field

MatrixProperty

Metadata properties set to true

None

This example shows how to use a MatrixTransform to translate (move) the position, stretch, and skew of a Button.

NoteNote

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


<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
  <StackPanel Margin="20">
    <Canvas HorizontalAlignment="Left" Width="340" Height="240" >

      <Button MinWidth="100">Click
        <Button.RenderTransform>
          <MatrixTransform x:Name="myMatrixTransform">
            <MatrixTransform.Matrix >

              <!-- OffsetX and OffsetY specify the position of the button,
              M11 stretches it, and M12 skews it. -->
              <Matrix OffsetX="10" OffsetY="100" M11="3" M12="2"/>
            </MatrixTransform.Matrix>
          </MatrixTransform>
        </Button.RenderTransform>
      </Button>
    </Canvas>
  </StackPanel>
</Page>


More Code

How to: Animate a Matrix by Using Key FramesThis example shows how to animate the Matrix property of a MatrixTransform by using key frames.
How to: Animate an Object Along a Path (Matrix Animation)This example shows how to use the MatrixAnimationUsingPath class to animate an object along a path that is defined by a PathGeometry.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Community Additions

ADD
Show:
© 2015 Microsoft