MohamedG's Log

TW9oYW1lZCBFbC1HZWlzaA==

Changing the Foreground Color of an Indeterminate ProgressBar

You would think that the following XAML changes the indeterminate progress bar’s foreground color:

<ProgressBar IsIndeterminate="True" Foreground="Aquamarine" />

Unfortunately, that doesn’t work. You will need to override the following value in the default theme resource dictionary:

<ResourceDictionary.ThemeDictionaries>
    <ResourceDictionary x:Key="Default">
        <x:String x:Key="ProgressBarIndeterminateForegroundThemeBrush">Aquamarine</x:String>
    </ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

You can add that override to App.xaml, or to a new resource dictionary that’s merged into App.xaml:

<Application
    x:Class="Sample.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Common/StandardStyles.xaml" />
                <ResourceDictionary Source="Common/CustomStyles.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

CustomStyles.xaml:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <!-- Global Overrides -->
    <ResourceDictionary.ThemeDictionaries>
        <ResourceDictionary x:Key="Default">
            <x:String x:Key="ProgressBarIndeterminateForegroundThemeBrush">Aquamarine</x:String>
        </ResourceDictionary>
    </ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>