【发布时间】:2016-07-06 09:28:35
【问题描述】:
您好,我正在努力解决 XAML 中的轮换问题。我找到了一个 LayoutTransform 应该可以解决这个问题的解决方案,但是在 Windows 通用平台上这个选项不可用!
这是我的代码:
<StackPanel Orientation="Horizontal" VerticalAlignment="Center"
HorizontalAlignment="Center">
<Rectangle Fill="Red" Height="100" Width="100" />
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center"
Text="long long long long long long long long text"
RenderTransformOrigin="0.5,0.5" >
<TextBlock.RenderTransform>
<CompositeTransform Rotation="90"/>
</TextBlock.RenderTransform>
</TextBlock>
<Rectangle Fill="Green" Height="100" Width="100" />
</StackPanel>
但正如您所见,彩色框和文本块之间有很大的空白,您可以在此处看到:
所以我的第一个猜测是在文本块中添加一个Width="30" 属性,但这不起作用,正如您在此处看到的那样(不仅偏移是问题,而且裁剪也是问题):
有什么建议吗?
【问题讨论】:
标签: windows-10-universal rotatetransform