UIElement.RenderTransform Property
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Gets or sets transform information that affects the rendering position of a UIElement.
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.
<uiElement> <uiElement.RenderTransform> singleTransform </uiElement.RenderTransform> </uiElement>
XAML Values
Property Value
Type: System.Windows.Media.TransformDescribes the specifics of the desired render transform. The default value is null.
Dependency property identifier field: RenderTransformProperty
The Transform object can either be a single type of transform (such as RotateTransform) or a TransformGroup. The TransformGroup is not a transform per se, but is instead a container that enables you to specify more than one transform for a RenderTransform as markup children in XAML, or by adding transform items to the Children collection in code.
The local 0,0 for an object can be offset on a Canvas using Canvas.Left and Canvas.Top, but this does not count as a transform; the object retains its own local 0,0 in this case for transform purposes.
The render transform origin can also be offset with RenderTransformOrigin.
The following XAML defines a Matrix that provides data for a MatrixTransform applied to a rectangular shape as its RenderTransform. In this case, the matrix combines an offset (OffsetX and OffsetY) and a skew (M12). Note that this same effect could have been produced by combining a TranslateTransform and a SkewTransform; whether to use a single Matrix or combinations of discrete transforms (with TransformGroup) is a matter of coding style, the results are identical.
<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>