![](/img/trans.png)
[英]How to change the progress bar text color based on the progress percentage in WPF?
[英]Wpf: How to color portion of a rectangle based on percentage?
例如,您可以使用Border
元素填充Grid
:
<Grid>
<Grid.Resources>
<Style TargetType="Border">
<Setter Property="BorderThickness" Value="2 2 2 0" />
<Setter Property="BorderBrush" Value="Black" />
<Setter Property="SnapsToDevicePixels" Value="True" />
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition Height="20*" />
<RowDefinition Height="10*" />
<RowDefinition Height="25*" />
<RowDefinition Height="50*" />
</Grid.RowDefinitions>
<Border Background="Red" />
<Border Background="Yellow" Grid.Row="1" />
<Border Background="Green" Grid.Row="2" />
<Border Background="Blue" Grid.Row="3" BorderThickness="2" />
</Grid>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.