Click here to Skip to main content
15,893,622 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

Is there any simple way to add a Position transform to an element? Specifically, I am intrested in a RotateTransform

E.g.:
before:
|
x
|
a

after 180 degree rotate transform performed on letter 'a' with a center at point x:
a
|
x
|

NOT:
(rotated 'a')
|
x
|

Got it?

Thanks in advance,

Greetings - Jacek
Posted
Comments
Tarun.K.S 24-Nov-10 13:40pm    
how about specifying RenderTransformOrigin?

1 solution

How about this:

XML
<Window x:Class="Transform.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Label Content="A" Height="48" HorizontalAlignment="Left" Margin="134,124,0,0" Name="label1" VerticalAlignment="Top" Width="41" FontWeight="Bold" FontSize="32">
            <Label.RenderTransform>
                <RotateTransform Angle="-45" CenterX="-50" CenterY="-50" />
            </Label.RenderTransform>
        </Label>
    </Grid>
</Window>


This XAML is all that is needed. I have put the letter into a label, but this would also work with any other text and even with other controls.

Edit: You can't use transformations on a letter or a string directly, but you can use the transformation on the controls containing them.
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900