WPF: Using RenderTransform on ellipse

This entry is part 54 of 54 in the series Learn WPF

Suppose we want to rotate a particular element around its center, we can use dependency property RenderTransform.

<Window x:Class="Ellipse.MainWindow"
        Title="MainWindow" Height="350" Width="525">
    <Canvas Height="400" Width="400">
        <Ellipse Fill="Red" Width="100" Height="60" 
                <RotateTransform Angle="30" />

The output will be:


RenderTransformOrigin has a somewhat nonstandard use of the Point structure value.

Values between 0 and 1 are interpreted as a factor for the range of the current element in each x,y axis.

For example, (0.5,0.5) will cause the render transform to be centered on the element, or (1,1) would place the render transform at the bottom right corner of the element.


Series Navigation<< WPF: Creating overlapping rectangles using canvas