-1

As I try to change the progress bar colors, it now displays the background color when progress bar is in cycle mode

an image of the applied style will be better than any explanation

enter image description here

as I apply this style, the progress bar does not cycle anymore, it is filled with the same color

<Style TargetType="{x:Type ProgressBar}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type ProgressBar}">
                <Grid x:Name="TemplateRoot" SnapsToDevicePixels="true">
                    <Rectangle x:Name="PART_Track" 
                               Fill="{DynamicResource MyDimmedBrush}" />
                    <Rectangle x:Name="PART_Indicator"
                               HorizontalAlignment="Left" 
                               Fill="{DynamicResource MyBrush}"
                               Margin="{TemplateBinding Padding}" />
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

thanks for your help

2
  • What you call cycle mode is the indeterminate state of the ProgressBar, set by the IsIndeterminate property. The ControlTemplate in your Style is apparently missing a visualization of that state. See the ProgressBar Styles and Templates for an example.
    – Clemens
    Commented Jun 22 at 4:34
  • thanks for your help, I just had to override the colors Commented Jun 25 at 8:11

1 Answer 1

0

Apparently it is as simple as this

<Style TargetType="{x:Type ProgressBar}">
    <Setter Property="Background" Value="blue" />
    <Setter Property="Foreground" Value="red" />
</Style>

Not the answer you're looking for? Browse other questions tagged or ask your own question.