如何通过保持自动调整大小功能在WPF中旋转文本

如何通过保持自动调整大小功能在WPF中旋转文本,wpf,text,rotation,Wpf,Text,Rotation,我想要一个垂直的文本。我只是在WPF中使用一个简单的网格来自动调整区域大小。但是当使用旋转变换时,所有的计算都是错误的。你知道怎么解决这个问题吗 <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /&g

我想要一个垂直的文本。我只是在WPF中使用一个简单的网格来自动调整区域大小。但是当使用旋转变换时,所有的计算都是错误的。你知道怎么解决这个问题吗

        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>


在这幅图中,你明白我的意思。如果我现在想自动调整中间部分的大小,我不能使用“宽度”或“高度”属性,因为两者都会产生错误的大小调整结果。Width=120px将增加水平(原始)宽度,并使整行为120像素。高度=120px将使文本具有120像素的高度。

使用
布局转换
而不是
渲染转换
。它在布局过程中应用,而不是在渲染过程中应用。


<TextBlock Height="14" 
    x:Name="TextBlock1" 
    Text="Vertical Bottom to Up" Margin="73,0,115,0" RenderTransformOrigin="0.5,0.5" > 
    <TextBlock.RenderTransform> 
        <TransformGroup> 
            <ScaleTransform/> 
            <SkewTransform/> 
            <RotateTransform Angle="-90"/> 
            <TranslateTransform/> 
        </TransformGroup> 
    </TextBlock.RenderTransform> 
</TextBlock> 

就像Rachel说的使用LayoutTransform

<TextBlock Text="Goodday" >
   <TextBlock.LayoutTransform>
     <RotateTransform Angle="90" />
   </TextBlock.LayoutTransform>  
</TextBlock>

在Blend中,这有点“低于折叠”-这意味着您在默认情况下可以看到RenderTransform,并且必须展开Transforms面板才能看到LayoutTransform。我从来没有注意到它在那里,但确实它藏在几乎显而易见的地方。@Rachel UWP能使用布局转换吗?