我希望有一个进度条,而不是从左到右,从下到上填充。是否有任何属性或某种方法可以将UWP控件提供的默认进度条转换为垂直进度条?
了解如何应用rendertransform - 进度条流出网格。
这是代码!
<StackPanel Background="{StaticResource SystemControlAcrylicWindowBrush}" Padding="40">
<Grid BorderBrush="Black" BorderThickness="1,1,1,1" Width="220" Height="200">
<ProgressBar HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" RenderTransformOrigin="0.5,0.5"
Value="60">
<ProgressBar.RenderTransform>
<CompositeTransform Rotation="0"/>
</ProgressBar.RenderTransform>
</ProgressBar>
</Grid>
<Grid BorderBrush="Black" BorderThickness="1,1,1,1" Width="220" Height="200" Margin="40">
<ProgressBar HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" RenderTransformOrigin="0.5,0.5"
Value="60">
<ProgressBar.RenderTransform>
<CompositeTransform Rotation="-90"/>
</ProgressBar.RenderTransform>
</ProgressBar>
</Grid>
</StackPanel>
仍然没有固定,确实是宽度和高度!
删除了边距和填充,仍然无效!
答案 0 :(得分:4)
UWP ProgressBar
没有Orientation
属性。您无法在UWP中使用progbar.Orientation = Orientation.Horizontal;
。如果你想放置
垂直ProgressBar
,您可以使用RenderTransform
来实现它。
<ProgressBar RenderTransformOrigin="0.5,0.5"
Maximum="200"
Value="50"
Width="200"
Background="LightGray"
Foreground="Green"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<ProgressBar.RenderTransform>
<CompositeTransform Rotation="-90" />
</ProgressBar.RenderTransform>
</ProgressBar>