Reputation: 27
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>
Upvotes: 0
Views: 540
Reputation: 16119
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!
Upvotes: 1