Share via


UIElement.RenderTransform Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets transform information that affects the rendering position of a UIElement.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Property RenderTransform As Transform
public Transform RenderTransform { get; set; }
<uiElement>
  <uiElement.RenderTransform>
    singleTransform
  </uiElement.RenderTransform>
</uiElement>

XAML Values

Property Value

Type: System.Windows.Media.Transform
Describes the specifics of the desired render transform. The default value is nulla null reference (Nothing in Visual Basic).

Remarks

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.

Examples

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>

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

See Also

Reference

Other Resources