Do a LayoutTransform
instead of a RenderTransform
.
In WPF, RenderTransforms
are performed on controls after they have been laid out.
In your case, the Label
is being cut short by the width of the column, first; then, the RenderTransform is applied (the rotate is the only one that does anything), resulting it the odd-looking Label
.
A LayoutTransform
is done before a control is laid out.
Like this:
<Grid ShowGridLines="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="146.334" />
<ColumnDefinition Width="94.666" />
</Grid.ColumnDefinitions>
<Label
Name="label1"
Content="Prashant"
Margin="0"
Width="Auto"
VerticalAlignment="Center"
RenderTransformOrigin="0.5,0.5">
<Label.LayoutTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform AngleX="0" AngleY="0"/>
<RotateTransform Angle="-90"/>
<TranslateTransform X="0" Y="0"/>
</TransformGroup>
</Label.LayoutTransform>
</Label>
</Grid>
GreenReign
2009-07-17 07:10:39