旋转进度条的对齐

时间:2011-03-20 01:03:38

标签: wpf

我在显示旋转的进度条时遇到问题。理想情况下,我希望进度条和文本块之间没有差距。有什么建议吗?

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">                
            <ProgressBar Height="20" Width="430">
                <ProgressBar.RenderTransform>
                    <RotateTransform Angle="-90" />
                </ProgressBar.RenderTransform>
            </ProgressBar>

            <TextBlock Width="100" Height="500" Text="test" />
 </StackPanel>

1 个答案:

答案 0 :(得分:2)

尝试使用LayoutTransofrm而不是RenderTransform:

    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
        <ProgressBar Height="20" Width="430">
            <ProgressBar.LayoutTransform>
                <RotateTransform Angle="-90" />
            </ProgressBar.LayoutTransform>
        </ProgressBar>

        <TextBlock Width="100" Height="500" Text="test" />
    </StackPanel>