<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:hc="clr-namespace:HandyControl.Controls"
                    xmlns:system="clr-namespace:System;assembly=mscorlib"
                    xmlns:themes="clr-namespace:HandyControl.Themes">

    <ResourceDictionary.MergedDictionaries>
        <themes:SharedResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Styles/Base/ProgressBarBaseStyle.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Style BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="ProgressBar">
        <Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
    </Style>

    <Style x:Key="ProgressBarSuccess" BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="ProgressBar">
        <Setter Property="Foreground" Value="{DynamicResource SuccessBrush}"/>
    </Style>

    <Style x:Key="ProgressBarInfo" BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="ProgressBar">
        <Setter Property="Foreground" Value="{DynamicResource InfoBrush}"/>
    </Style>

    <Style x:Key="ProgressBarWarning" BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="ProgressBar">
        <Setter Property="Foreground" Value="{DynamicResource WarningBrush}"/>
    </Style>

    <Style x:Key="ProgressBarDanger" BasedOn="{StaticResource ProgressBarBaseStyle}" TargetType="ProgressBar">
        <Setter Property="Foreground" Value="{DynamicResource DangerBrush}"/>
    </Style>

    <Style x:Key="ProgressBarPrimaryStripe" BasedOn="{StaticResource ProgressBarStripeBaseStyle}" TargetType="ProgressBar">
        <Setter Property="Foreground">
            <Setter.Value>
                <DrawingBrush Viewport="0,0,20,32" TileMode="Tile" ViewportUnits="Absolute" Stretch="None">
                    <DrawingBrush.Transform>
                        <TransformGroup>
                            <RotateTransform Angle="20"/>
                            <TranslateTransform x:Name="MyTransform" X="0"/>
                        </TransformGroup>
                    </DrawingBrush.Transform>
                    <DrawingBrush.Drawing>
                        <GeometryDrawing>
                            <GeometryDrawing.Brush>
                                <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
                                    <GradientStop Color="{DynamicResource DarkPrimaryColor}" Offset="0"/>
                                    <GradientStop Color="{DynamicResource DarkPrimaryColor}" Offset="0.5"/>
                                    <GradientStop Color="{DynamicResource BackgroundColor}" Offset="0.5"/>
                                    <GradientStop Color="{DynamicResource BackgroundColor}" Offset="1"/>
                                </LinearGradientBrush>
                            </GeometryDrawing.Brush>
                            <GeometryDrawing.Geometry>
                                <RectangleGeometry Rect="0,0,20,32"/>
                            </GeometryDrawing.Geometry>
                        </GeometryDrawing>
                    </DrawingBrush.Drawing>
                </DrawingBrush>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ProgressBarSuccessStripe" BasedOn="{StaticResource ProgressBarStripeBaseStyle}" TargetType="ProgressBar">
        <Setter Property="Foreground">
            <Setter.Value>
                <DrawingBrush Viewport="0,0,20,32" TileMode="Tile" ViewportUnits="Absolute" Stretch="None">
                    <DrawingBrush.Transform>
                        <TransformGroup>
                            <RotateTransform Angle="20"/>
                            <TranslateTransform x:Name="MyTransform" X="0"/>
                        </TransformGroup>
                    </DrawingBrush.Transform>
                    <DrawingBrush.Drawing>
                        <GeometryDrawing>
                            <GeometryDrawing.Brush>
                                <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
                                    <GradientStop Color="{DynamicResource DarkSuccessColor}" Offset="0"/>
                                    <GradientStop Color="{DynamicResource DarkSuccessColor}" Offset="0.5"/>
                                    <GradientStop Color="{DynamicResource BackgroundColor}" Offset="0.5"/>
                                    <GradientStop Color="{DynamicResource BackgroundColor}" Offset="1"/>
                                </LinearGradientBrush>
                            </GeometryDrawing.Brush>
                            <GeometryDrawing.Geometry>
                                <RectangleGeometry Rect="0,0,20,32"/>
                            </GeometryDrawing.Geometry>
                        </GeometryDrawing>
                    </DrawingBrush.Drawing>
                </DrawingBrush>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ProgressBarInfoStripe" BasedOn="{StaticResource ProgressBarStripeBaseStyle}" TargetType="ProgressBar">
        <Setter Property="Foreground">
            <Setter.Value>
                <DrawingBrush Viewport="0,0,20,32" TileMode="Tile" ViewportUnits="Absolute" Stretch="None">
                    <DrawingBrush.Transform>
                        <TransformGroup>
                            <RotateTransform Angle="20"/>
                            <TranslateTransform x:Name="MyTransform" X="0"/>
                        </TransformGroup>
                    </DrawingBrush.Transform>
                    <DrawingBrush.Drawing>
                        <GeometryDrawing>
                            <GeometryDrawing.Brush>
                                <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
                                    <GradientStop Color="{DynamicResource DarkInfoColor}" Offset="0"/>
                                    <GradientStop Color="{DynamicResource DarkInfoColor}" Offset="0.5"/>
                                    <GradientStop Color="{DynamicResource BackgroundColor}" Offset="0.5"/>
                                    <GradientStop Color="{DynamicResource BackgroundColor}" Offset="1"/>
                                </LinearGradientBrush>
                            </GeometryDrawing.Brush>
                            <GeometryDrawing.Geometry>
                                <RectangleGeometry Rect="0,0,20,32"/>
                            </GeometryDrawing.Geometry>
                        </GeometryDrawing>
                    </DrawingBrush.Drawing>
                </DrawingBrush>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ProgressBarWarningStripe" BasedOn="{StaticResource ProgressBarStripeBaseStyle}" TargetType="ProgressBar">
        <Setter Property="Foreground">
            <Setter.Value>
                <DrawingBrush Viewport="0,0,20,32" TileMode="Tile" ViewportUnits="Absolute" Stretch="None">
                    <DrawingBrush.Transform>
                        <TransformGroup>
                            <RotateTransform Angle="20"/>
                            <TranslateTransform x:Name="MyTransform" X="0"/>
                        </TransformGroup>
                    </DrawingBrush.Transform>
                    <DrawingBrush.Drawing>
                        <GeometryDrawing>
                            <GeometryDrawing.Brush>
                                <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
                                    <GradientStop Color="{DynamicResource DarkWarningColor}" Offset="0"/>
                                    <GradientStop Color="{DynamicResource DarkWarningColor}" Offset="0.5"/>
                                    <GradientStop Color="{DynamicResource BackgroundColor}" Offset="0.5"/>
                                    <GradientStop Color="{DynamicResource BackgroundColor}" Offset="1"/>
                                </LinearGradientBrush>
                            </GeometryDrawing.Brush>
                            <GeometryDrawing.Geometry>
                                <RectangleGeometry Rect="0,0,20,32"/>
                            </GeometryDrawing.Geometry>
                        </GeometryDrawing>
                    </DrawingBrush.Drawing>
                </DrawingBrush>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ProgressBarDangerStripe" BasedOn="{StaticResource ProgressBarStripeBaseStyle}" TargetType="ProgressBar">
        <Setter Property="Foreground">
            <Setter.Value>
                <DrawingBrush Viewport="0,0,20,32" TileMode="Tile" ViewportUnits="Absolute" Stretch="None">
                    <DrawingBrush.Transform>
                        <TransformGroup>
                            <RotateTransform Angle="20"/>
                            <TranslateTransform x:Name="MyTransform" X="0"/>
                        </TransformGroup>
                    </DrawingBrush.Transform>
                    <DrawingBrush.Drawing>
                        <GeometryDrawing>
                            <GeometryDrawing.Brush>
                                <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
                                    <GradientStop Color="{DynamicResource DarkDangerColor}" Offset="0"/>
                                    <GradientStop Color="{DynamicResource DarkDangerColor}" Offset="0.5"/>
                                    <GradientStop Color="{DynamicResource BackgroundColor}" Offset="0.5"/>
                                    <GradientStop Color="{DynamicResource BackgroundColor}" Offset="1"/>
                                </LinearGradientBrush>
                            </GeometryDrawing.Brush>
                            <GeometryDrawing.Geometry>
                                <RectangleGeometry Rect="0,0,20,32"/>
                            </GeometryDrawing.Geometry>
                        </GeometryDrawing>
                    </DrawingBrush.Drawing>
                </DrawingBrush>
            </Setter.Value>
        </Setter>
    </Style>

    <Style BasedOn="{StaticResource ProgressBarCircleBaseStyle}" TargetType="hc:CircleProgressBar">
        <Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
    </Style>

    <Style x:Key="ProgressBarSuccessCircle" BasedOn="{StaticResource ProgressBarCircleBaseStyle}" TargetType="hc:CircleProgressBar">
        <Setter Property="Foreground" Value="{DynamicResource SuccessBrush}"/>
    </Style>

    <Style x:Key="ProgressBarInfoCircle" BasedOn="{StaticResource ProgressBarCircleBaseStyle}" TargetType="hc:CircleProgressBar">
        <Setter Property="Foreground" Value="{DynamicResource InfoBrush}"/>
    </Style>

    <Style x:Key="ProgressBarWarningCircle" BasedOn="{StaticResource ProgressBarCircleBaseStyle}" TargetType="hc:CircleProgressBar">
        <Setter Property="Foreground" Value="{DynamicResource WarningBrush}"/>
    </Style>

    <Style x:Key="ProgressBarDangerCircle" BasedOn="{StaticResource ProgressBarCircleBaseStyle}" TargetType="hc:CircleProgressBar">
        <Setter Property="Foreground" Value="{DynamicResource DangerBrush}"/>
    </Style>

    <Style BasedOn="{StaticResource ProgressBarWaveBaseStyle}" TargetType="hc:WaveProgressBar">
        <Setter Property="WaveFill" Value="{DynamicResource DarkPrimaryBrush}"/>
    </Style>

    <Style x:Key="ProgressBarSuccessWave" BasedOn="{StaticResource ProgressBarWaveBaseStyle}" TargetType="hc:WaveProgressBar">
        <Setter Property="WaveFill" Value="{DynamicResource DarkSuccessBrush}"/>
    </Style>

    <Style x:Key="ProgressBarInfoWave" BasedOn="{StaticResource ProgressBarWaveBaseStyle}" TargetType="hc:WaveProgressBar">
        <Setter Property="WaveFill" Value="{DynamicResource DarkInfoBrush}"/>
    </Style>

    <Style x:Key="ProgressBarWarningWave" BasedOn="{StaticResource ProgressBarWaveBaseStyle}" TargetType="hc:WaveProgressBar">
        <Setter Property="WaveFill" Value="{DynamicResource DarkWarningBrush}"/>
    </Style>

    <Style x:Key="ProgressBarDangerWave" BasedOn="{StaticResource ProgressBarWaveBaseStyle}" TargetType="hc:WaveProgressBar">
        <Setter Property="WaveFill" Value="{DynamicResource DarkDangerBrush}"/>
    </Style>

    <Style x:Key="ProgressBarFlat" TargetType="ProgressBar">
        <Setter Property="Height" Value="4"/>
        <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
        <Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ProgressBar">
                    <ControlTemplate.Resources>
                        <Storyboard x:Key="IsIndeterminate" RepeatBehavior="Forever">
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="Animation">
                                <EasingDoubleKeyFrame KeyTime="0" Value="0.25"/>
                                <EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.25"/>
                                <EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.25"/>
                            </DoubleAnimationUsingKeyFrames>
                            <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="Animation">
                                <EasingPointKeyFrame KeyTime="0" Value="-0.5,0.5"/>
                                <EasingPointKeyFrame KeyTime="0:0:1" Value="0.5,0.5"/>
                                <EasingPointKeyFrame KeyTime="0:0:2" Value="1.5,0.5"/>
                            </PointAnimationUsingKeyFrames>
                        </Storyboard>
                    </ControlTemplate.Resources>
                    <hc:SimplePanel x:Name="TemplateRoot" SnapsToDevicePixels="true" ClipToBounds="True">
                        <Rectangle x:Name="PART_Track" Fill="{TemplateBinding Background}" StrokeThickness="0" Stroke="{TemplateBinding BorderBrush}"/>
                        <Decorator x:Name="PART_Indicator" HorizontalAlignment="Left">
                            <Rectangle x:Name="Indicator" Fill="{TemplateBinding Foreground}"/>
                        </Decorator>
                        <Rectangle x:Name="Animation" Visibility="Collapsed" Fill="{TemplateBinding Foreground}" RenderTransformOrigin="0.5,0.5">
                            <Rectangle.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform/>
                                </TransformGroup>
                            </Rectangle.RenderTransform>
                        </Rectangle>
                    </hc:SimplePanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsIndeterminate" Value="true">
                            <Trigger.EnterActions>
                                <BeginStoryboard Storyboard="{StaticResource IsIndeterminate}"/>
                            </Trigger.EnterActions>
                            <Setter Property="Visibility" TargetName="Indicator" Value="Collapsed"/>
                            <Setter Property="Visibility" TargetName="Animation" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="Orientation" Value="Vertical">
                            <Setter Property="Height" Value="{x:Static system:Double.NaN}"/>
                            <Setter Property="LayoutTransform" TargetName="TemplateRoot">
                                <Setter.Value>
                                    <RotateTransform Angle="-90"/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>