嗨我在XAML中正在努力进行轮换.我发现LayoutTransform应该解决这个问题的解决方案,但是在
Windows Universal Plattform上这个选项不可用!
这是我的代码:
<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”属性,但这不起作用,你可以在这里看到(不仅偏移是问题,而且裁剪是问题):
有什么建议?
最佳答案 尝试WinRTXamlToolkit的LayoutTransform控件.以下链接应该有帮助.
Github Source链接和Demo链接