Incorrect colors in WPF Progress Bar

EDIT: I solved my problem ... take a look at my answer. It is right if it is wrong. Thanks.

Question: For some reason, it seems that the progress bar in a WPF application does not show the required color.

Here is the XAML code:

<Window x:Class="TaskbarProgressApp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Window.TaskbarItemInfo> <TaskbarItemInfo /> </Window.TaskbarItemInfo> <Grid> <ProgressBar x:Name="ProgressBar" Margin="10" HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="23" Background="{x:Null}" Foreground="DarkRed"> </ProgressBar> </Grid> </Window> 

Here is the result:

enter image description here

Not like Dark Red for me ... happens with every color :(

Any thoughts?

+6
source share
2 answers

Thanks to @Merlyn Morgan-Graham and @CharithJ for pointing out another question, I thought it was something completely different when I read it.

I solved the problem and I would like to share it.

I downloaded the trial version of MS Expression Blend and changed:

 <Trigger Property="IsIndeterminate" Value="false"> <Setter Property="Background" TargetName="Animation" Value="#80B5FFA9"/> </Trigger> 

For

 <Trigger Property="IsIndeterminate" Value="false"> <Setter Property="Background" TargetName="Animation" Value="#00000000"/> </Trigger> 

It gives colors like these:

Dark red:

enter image description here

Even it works

 <Trigger Property="IsIndeterminate" Value="true"> <Setter Property="Background" TargetName="Animation" Value="#80B5FFA9"/> </Trigger> 

The progress bar does not change, but the colors are as they should be.

It is sad that there is no way to change it directly.

Thanks for the help.

+5
source

You can do this by changing the control template. Here is an article on that of MSDN. ProgressBar Checklist Example

Here is another similar stream.

+4
source

Source: https://habr.com/ru/post/896371/


All Articles