i'm trying to make my progressbar look like this:
But i have this instead:
This is the code i have (i created a style for the progressbar with the property "fill" of the indicator):
<Rectangle x:Name="Indicator" >
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0,0" StartPoint="1,0">
<GradientStop Color="Red" Offset="0"/>
<GradientStop Color="Yellow" Offset="0.5"/>
<GradientStop Color="Green" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
Welcome to SO!
Just set that indicator's width to the same as that of the parent ProgressBar:
<Rectangle x:Name="Indicator" Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ProgressBar}}">
Simple!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.