<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <!--  ProgressBar Style  -->
    <Style x:Key="MahApps.Metro.Styles.ProgressBar" TargetType="ProgressBar">
        <Setter Property="Background" Value="{DynamicResource GrayBrush5}" />
        <Setter Property="BorderBrush" Value="{DynamicResource ControlBorderBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Foreground" Value="{DynamicResource HighlightBrush}" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="Maximum" Value="100" />
        <Setter Property="MinHeight" Value="10" />
        <Setter Property="MinWidth" Value="10" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ProgressBar">
                    <Grid x:Name="Root">
                        <Border x:Name="PART_Track"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}" />
                        <Grid x:Name="ProgressBarRootGrid">
                            <Grid x:Name="IndeterminateRoot" Visibility="Collapsed">
                                <Rectangle x:Name="IndeterminateSolidFill"
                                           Margin="{TemplateBinding BorderThickness}"
                                           Fill="{DynamicResource ProgressBrush}"
                                           Opacity="1"
                                           RenderTransformOrigin="0.5,0.5"
                                           StrokeThickness="0" />
                                <Rectangle x:Name="IndeterminateGradientFill"
                                           Margin="{TemplateBinding BorderThickness}"
                                           Opacity="0.7"
                                           StrokeThickness="1">
                                    <Rectangle.Fill>
                                        <LinearGradientBrush MappingMode="Absolute" SpreadMethod="Repeat" StartPoint="20,1" EndPoint="0,1">
                                            <LinearGradientBrush.Transform>
                                                <TransformGroup>
                                                    <TranslateTransform x:Name="xTransform" X="0" />
                                                    <SkewTransform AngleX="-30" />
                                                </TransformGroup>
                                            </LinearGradientBrush.Transform>
                                            <GradientStop Offset="0" Color="{DynamicResource ProgressIndeterminateColor1}" />
                                            <GradientStop Offset="0.651" Color="{DynamicResource ProgressIndeterminateColor2}" />
                                            <GradientStop Offset="0.093" Color="{DynamicResource ProgressIndeterminateColor3}" />
                                            <GradientStop Offset="0.548" Color="{DynamicResource ProgressIndeterminateColor4}" />
                                        </LinearGradientBrush>
                                    </Rectangle.Fill>
                                </Rectangle>
                            </Grid>
                            <Grid x:Name="DeterminateRoot" Margin="1">
                                <Border x:Name="PART_Indicator"
                                        Margin="-1"
                                        HorizontalAlignment="Left"
                                        Background="{DynamicResource ProgressBrush}">
                                    <Rectangle x:Name="GradientFill"
                                               Opacity="0.7"
                                               Visibility="Collapsed">
                                        <Rectangle.Fill>
                                            <LinearGradientBrush MappingMode="Absolute" SpreadMethod="Repeat" StartPoint="20,1" EndPoint="0,1">
                                                <LinearGradientBrush.Transform>
                                                    <TransformGroup>
                                                        <TranslateTransform X="0" />
                                                        <SkewTransform AngleX="-30" />
                                                    </TransformGroup>
                                                </LinearGradientBrush.Transform>
                                                <GradientStop Offset="0" Color="{DynamicResource ProgressIndeterminateColor1}" />
                                                <GradientStop Offset="0.651" Color="{DynamicResource ProgressIndeterminateColor2}" />
                                                <GradientStop Offset="0.093" Color="{DynamicResource ProgressIndeterminateColor3}" />
                                                <GradientStop Offset="0.548" Color="{DynamicResource ProgressIndeterminateColor4}" />
                                            </LinearGradientBrush>
                                        </Rectangle.Fill>
                                    </Rectangle>
                                </Border>
                            </Grid>
                        </Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Determinate" />
                                <VisualState x:Name="Indeterminate">
                                    <Storyboard RepeatBehavior="Forever">
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="IndeterminateRoot"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)"
                                                                       Duration="00:00:00">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DeterminateRoot"
                                                                       Storyboard.TargetProperty="(UIElement.Visibility)"
                                                                       Duration="00:00:00">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="xTransform" Storyboard.TargetProperty="X">
                                            <SplineDoubleKeyFrame KeyTime="0" Value="0" />
                                            <SplineDoubleKeyFrame KeyTime="00:00:.35" Value="20" />
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Orientation" Value="Vertical">
                            <Setter TargetName="Root" Property="LayoutTransform">
                                <Setter.Value>
                                    <RotateTransform Angle="-90" />
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsIndeterminate" Value="true">
                            <Setter TargetName="DeterminateRoot" Property="Visibility" Value="Collapsed" />
                            <Setter TargetName="IndeterminateRoot" Property="Visibility" Value="Visible" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--  obsolete  -->
    <Style x:Key="MetroProgressBar"
           BasedOn="{StaticResource MahApps.Metro.Styles.ProgressBar}"
           TargetType="ProgressBar" />

</ResourceDictionary>