Andy Clarke
Andy Clarke

Reputation: 3262

WinRT scale and ellipse but keep it centred

   <Ellipse HorizontalAlignment="Center" Height="238" Stroke="Black" StrokeThickness="3" VerticalAlignment="Top" Width="300">
        <Ellipse.RenderTransform>
            <TransformGroup>
                <ScaleTransform ScaleX="1.3" CenterX="0.5" />

            </TransformGroup>

        </Ellipse.RenderTransform>
    </Ellipse>

I'm trying to get an Ellipse to Stretch in the center of the screen, however it always stetches to the right - I've been playing around with CenterX thinking that this is setting the Center point? But it's not having any effect.

Can anyone assist please?

Upvotes: 2

Views: 509

Answers (1)

nemesv
nemesv

Reputation: 139758

You need to set the RenderTransformOrigin on the Ellipse to 0.5,0.5 in order to keep it centered:

<Ellipse RenderTransformOrigin="0.5,0.5" 
     HorizontalAlignment="Center" Height="238" Stroke="Black" 
     StrokeThickness="3" VerticalAlignment="Top" Width="300">
    <Ellipse.RenderTransform>
        <TransformGroup>
            <ScaleTransform ScaleX="1.3" CenterX="0.5" />
        </TransformGroup>
    </Ellipse.RenderTransform>
</Ellipse>

Upvotes: 1

Related Questions