Nas*_*aer 32 wpf text rotation
我希望文本垂直.我只是在WPF中使用一个简单的网格来自动调整区域大小.但在使用时RotateTransform
,所有计算都是错误的.不知道怎么解决这个问题?
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
Run Code Online (Sandbox Code Playgroud)
在这张图片中你看到了我的意思.如果我现在想要自动调整中间部分的大小,我不能使用"宽度"或"高度"属性,因为两者都会引发错误的大小调整结果.宽度= 120px将增加水平(原始)宽度并将使整行120像素.高度= 120px将使文本高度为120像素.
Max*_*zur 27
就像Rachel所说的那样使用LayoutTransform
<TextBlock Text="Goodday" >
<TextBlock.LayoutTransform>
<RotateTransform Angle="90" />
</TextBlock.LayoutTransform>
</TextBlock>
Run Code Online (Sandbox Code Playgroud)