【问题标题】:WPF XAML Rotate 90° in UWP margin issueWPF XAML 在 UWP 边距问题中旋转 90°
【发布时间】: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


    【解决方案1】:

    试试 WinRTXamlToolkit 的 LayoutTransform 控件。以下链接应该会有所帮助。

    Github Source 链接和Demo 链接

    【讨论】:

      猜你喜欢
      • 2015-12-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-10
      • 2011-04-03
      • 2014-05-23
      • 1970-01-01
      相关资源
      最近更新 更多