<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:ForzaUI" 
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    mc:Ignorable="d"
    x:Class="ForzaUI.HUDStuntPartyProgressControl"
    x:Name="UserControl"
    Margin="0,0,0,0"
    VerticalAlignment="Bottom">

    <UserControl.Resources>
        <ResourceDictionary>

            <Thickness x:Key="A_Thickness_ContentsMargin">20,16,20,16</Thickness>
            <System:Double x:Key="A_Double_MinorNotification_Height">76</System:Double>
            <System:Double x:Key="A_Double_MinorNotification_ContentsWidth">288.5</System:Double>

            <Style x:Key="A_Style_FrameworkElement_Notification" TargetType="{x:Type FrameworkElement}">
                <Setter Property="local:ZPanel.Transform">
                    <Setter.Value>
                        <Transform3DGroup>
                            <RotateTransform3D CenterY="40">
                                <RotateTransform3D.Rotation>
                                    <AxisAngleRotation3D Axis="-1,0,0" Angle="0"/>
                                </RotateTransform3D.Rotation>
                            </RotateTransform3D>
                            <TranslateTransform3D OffsetZ="0"/>
                        </Transform3DGroup>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="A_Style_StuntPartyProgressMarkup_NUM" TargetType="{x:Type local:FZRun}">
                <Setter Property="FontFamily" Value="Horizon_A"/>
            </Style>

            <local:MappingConverter x:Key="A_MappingConverter_ChallengeTypeToSpeedUnitBoolean" Default="{StaticResource A_Boolean_False}">
                <local:MappingConverterEntry Key="{x:Static local:HUDChallengeType.SpeedTrap}" Value="{StaticResource A_Boolean_True}" />
                <local:MappingConverterEntry Key="{x:Static local:HUDChallengeType.SpeedZone}" Value="{StaticResource A_Boolean_True}" />
                <local:MappingConverterEntry Key="{x:Static local:HUDChallengeType.MultiSpeedTrap}" Value="{StaticResource A_Boolean_True}" />
                <local:MappingConverterEntry Key="{x:Static local:HUDChallengeType.MultiSpeedZone}" Value="{StaticResource A_Boolean_True}" />
                <local:MappingConverterEntry Key="{x:Static local:HUDChallengeType.MaintainMinSpeed}" Value="{StaticResource A_Boolean_True}" />
                <local:MappingConverterEntry Key="{x:Static local:HUDChallengeType.MaintainSpeed}" Value="{StaticResource A_Boolean_True}" />
            </local:MappingConverter>

            <local:MappingConverter x:Key="A_MappingConverter_ChallengeTypeToLengthUnitBoolean" Default="{StaticResource A_Boolean_False}">
                <local:MappingConverterEntry Key="{x:Static local:HUDChallengeType.DangerSign}" Value="{StaticResource A_Boolean_True}" />
                <local:MappingConverterEntry Key="{x:Static local:HUDChallengeType.MultiDangerSign}" Value="{StaticResource A_Boolean_True}" />
            </local:MappingConverter>

            <local:MappingConverter x:Key="A_MappingConverter_ChallengeTypeToPointsUnitBoolean" Default="{StaticResource A_Boolean_False}">
                <local:MappingConverterEntry Key="{x:Static local:HUDChallengeType.DriftDrive}" Value="{StaticResource A_Boolean_True}" />
                <local:MappingConverterEntry Key="{x:Static local:HUDChallengeType.DriftZone}" Value="{StaticResource A_Boolean_True}" />
                <local:MappingConverterEntry Key="{x:Static local:HUDChallengeType.MultiDriftZone}" Value="{StaticResource A_Boolean_True}" />
            </local:MappingConverter>

            <local:MultiConverter x:Key="A_Converter_Unitless">
                <local:MultiConverterEntry Converter="{StaticResource A_NumUnitConverter_NoUnit_0dp_InsertMarkup}"/>
                <local:MultiConverterEntry Converter="{StaticResource A_StringToUpper}"/>
            </local:MultiConverter>

            <local:MultiConverter x:Key="A_Converter_SpeedUnit">
                <local:MultiConverterEntry Converter="{StaticResource A_NumUnitConverter_ShowUnit_2dp_InsertMarkup}" Parameter="speed"/>
                <local:MultiConverterEntry Converter="{StaticResource A_StringToUpper}"/>
            </local:MultiConverter>

            <local:MultiConverter x:Key="A_Converter_LengthUnit">
                <local:MultiConverterEntry Converter="{StaticResource A_NumUnitConverter_ShowUnit_2dp_InsertMarkup}" Parameter="length" />
                <local:MultiConverterEntry Converter="{StaticResource A_StringToUpper}"/>
            </local:MultiConverter>

            <local:MultiConverter x:Key="A_Converter_PointsUnit">
                <local:MultiConverterEntry Converter="{StaticResource A_NumUnitConverter_ShowUnit_0dp_InsertMarkup}" Parameter="points"/>
                <local:MultiConverterEntry Converter="{StaticResource A_StringToUpper}"/>
            </local:MultiConverter>

            <Style x:Key="A_Style_Text_CurrentScore" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}">
                <Setter Property="local:TextBlockInlineMarkup.Markup" Value="{Binding (local:BindingProxy.AlwaysValidNumeric), RelativeSource={RelativeSource Self}, Converter={StaticResource A_Converter_Unitless}}"/>
                <Setter Property="local:TextBlockInlineMarkup.ResourceBaseName" Value="A_Style_StuntPartyProgressMarkup_"/>
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="Color" Value="{StaticResource A_Color_HUD_Text}" />
                <Setter Property="FontSize" Value="42"/>
                <Setter Property="Effect" Value="{StaticResource A_DropShadowEffect_DefaultHud}" />
                <Setter Property="Stretch" Value="Uniform"/>
                <Setter Property="StretchDirection" Value="DownOnly"/>
                <Setter Property="HorizontalAlignment" Value="Center"/>
                <Setter Property="Margin" Value="{StaticResource A_Thickness_ContentsMargin}"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding ChallengeType, Converter={StaticResource A_MappingConverter_ChallengeTypeToSpeedUnitBoolean}}" Value="{StaticResource A_Boolean_True}">
                        <Setter Property="local:TextBlockInlineMarkup.Markup" Value="{Binding (local:BindingProxy.AlwaysValidNumeric), RelativeSource={RelativeSource Self}, Converter={StaticResource A_Converter_SpeedUnit}}"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding ChallengeType, Converter={StaticResource A_MappingConverter_ChallengeTypeToLengthUnitBoolean}}" Value="{StaticResource A_Boolean_True}">
                        <Setter Property="local:TextBlockInlineMarkup.Markup" Value="{Binding (local:BindingProxy.AlwaysValidNumeric), RelativeSource={RelativeSource Self}, Converter={StaticResource A_Converter_LengthUnit}}"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding ChallengeType, Converter={StaticResource A_MappingConverter_ChallengeTypeToPointsUnitBoolean}}" Value="{StaticResource A_Boolean_True}">
                        <Setter Property="local:TextBlockInlineMarkup.Markup" Value="{Binding (local:BindingProxy.AlwaysValidNumeric), RelativeSource={RelativeSource Self}, Converter={StaticResource A_Converter_PointsUnit}}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Color x:Key="A_Color_ForzathonLive_GradientA">#F800C0</Color>
            <Color x:Key="A_Color_ForzathonLive_GradientB">#FF1970</Color>

            <Color x:Key="A_Color_ForzathonLive_Darkened_GradientA">#940073</Color>
            <Color x:Key="A_Color_ForzathonLive_Darkened_GradientB">#990F43</Color>

            <Style x:Key="A_Style_ProgressBar_StuntPartyProgress"
                   TargetType="{x:Type ProgressBar}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ProgressBar}">
                            <DockPanel x:Name="PART_Track" Width="{StaticResource A_Double_MinorNotification_ContentsWidth}">
                                <Decorator x:Name="PART_Indicator" ClipToBounds="True" HorizontalAlignment="Left" Width="{StaticResource A_Double_MinorNotification_ContentsWidth}">
                                    <local:FZMaterial
                                        Width="{StaticResource A_Double_MinorNotification_ContentsWidth}">
                                        <local:FZMaterial.Preset>
                                            <local:FZMaterialPresetRoundtangle BasedOn="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterRightOnly}"
                                                GradientColorA="{StaticResource A_Color_ForzathonLive_Darkened_GradientA}"
                                                GradientColorB="{StaticResource A_Color_ForzathonLive_Darkened_GradientB}"
                                                GradientAngle="90"/>
                                        </local:FZMaterial.Preset>
                                    </local:FZMaterial>
                                </Decorator>
                            </DockPanel>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <System:TimeSpan x:Key="A_TimeSpan_Flash_Bar_FadeInDuration">0:0:0.033</System:TimeSpan>
            <System:TimeSpan x:Key="A_TimeSpan_Flash_HardEdge_FadeInDuration">0:0:0.1</System:TimeSpan>
            <System:TimeSpan x:Key="A_TimeSpan_Flash_SoftEdge_FadeInDuration">0:0:0.15</System:TimeSpan>

            <System:TimeSpan x:Key="A_TimeSpan_Flash_Bar_MaxOpacityDuration">0:0:0.0</System:TimeSpan>
            <System:TimeSpan x:Key="A_TimeSpan_Flash_HardEdge_MaxOpacityDuration">0:0:0.0</System:TimeSpan>
            <System:TimeSpan x:Key="A_TimeSpan_Flash_SoftEdge_MaxOpacityDuration">0:0:0.0</System:TimeSpan>

            <System:TimeSpan x:Key="A_TimeSpan_Flash_Bar_FadeOutDuration">0:0:1.0</System:TimeSpan>
            <System:TimeSpan x:Key="A_TimeSpan_Flash_HardEdge_FadeOutDuration">0:0:0.4</System:TimeSpan>
            <System:TimeSpan x:Key="A_TimeSpan_Flash_SoftEdge_FadeOutDuration">0:0:0.35</System:TimeSpan>

            <KeyTime x:Key="A_KeyTime_HardEdge_FadeInStart">0:0:0.0</KeyTime>
            <local:OffsetKeyTime x:Key="A_KeyTime_HardEdge_FadeInEnd"
                KeyTime="{StaticResource A_KeyTime_HardEdge_FadeInStart}"
                Offset="{StaticResource A_TimeSpan_Flash_HardEdge_FadeInDuration}"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_HardEdge_FadeOutStart"
                KeyTime="{StaticResource A_KeyTime_HardEdge_FadeInEnd}"
                Offset="{StaticResource A_TimeSpan_Flash_HardEdge_MaxOpacityDuration}"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_HardEdge_FadeOutEnd"
                KeyTime="{StaticResource A_KeyTime_HardEdge_FadeOutStart}"
                Offset="{StaticResource A_TimeSpan_Flash_HardEdge_FadeOutDuration}"/>

            <!--<KeyTime x:Key="A_KeyTime_Bar_FadeInStart">0:0:0.0</KeyTime>-->
            <local:OffsetKeyTime x:Key="A_KeyTime_Bar_FadeInStart"
                KeyTime="{StaticResource A_KeyTime_HardEdge_FadeInEnd}"
                Offset="0:0:0.0"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_Bar_FadeInEnd"
                KeyTime="{StaticResource A_KeyTime_Bar_FadeInStart}"
                Offset="{StaticResource A_TimeSpan_Flash_Bar_FadeInDuration}"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_Bar_FadeOutStart"
                KeyTime="{StaticResource A_KeyTime_Bar_FadeInEnd}"
                Offset="{StaticResource A_TimeSpan_Flash_Bar_MaxOpacityDuration}"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_Bar_FadeOutEnd"
                KeyTime="{StaticResource A_KeyTime_Bar_FadeOutStart}"
                Offset="{StaticResource A_TimeSpan_Flash_Bar_FadeOutDuration}"/>

            <!--<KeyTime x:Key="A_KeyTime_SoftEdge_FadeInStart">0:0:0.0</KeyTime>-->
            <local:OffsetKeyTime x:Key="A_KeyTime_SoftEdge_FadeInStart"
                KeyTime="{StaticResource A_KeyTime_HardEdge_FadeInEnd}"
                Offset="0:0:0.0"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_SoftEdge_FadeInEnd"
                KeyTime="{StaticResource A_KeyTime_SoftEdge_FadeInStart}"
                Offset="{StaticResource A_TimeSpan_Flash_SoftEdge_FadeInDuration}"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_SoftEdge_FadeOutStart"
                KeyTime="{StaticResource A_KeyTime_SoftEdge_FadeInEnd}"
                Offset="{StaticResource A_TimeSpan_Flash_SoftEdge_MaxOpacityDuration}"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_SoftEdge_FadeOutEnd"
                KeyTime="{StaticResource A_KeyTime_SoftEdge_FadeOutStart}"
                Offset="{StaticResource A_TimeSpan_Flash_SoftEdge_FadeOutDuration}"/>

            <local:UIStoryboard x:Key="A_Storyboard_HardEdgeGlow">
                <DoubleAnimationUsingKeyFrames
                    Storyboard.TargetName="{x:Null}"
                    Storyboard.TargetProperty="(UIElement.Opacity)"
                    FillBehavior="Stop">
                    <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_HardEdge_FadeInStart}"
                        Value="0.0"/>
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_HardEdge_FadeInEnd}"
                        Value="1.0"
                        EasingFunction="{local:LinearEasing}" />
                    <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_HardEdge_FadeOutStart}"
                        Value="1.0"/>
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_HardEdge_FadeOutEnd}"
                        Value="0.0"
                        EasingFunction="{local:LinearEasing}" />
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames
                    Storyboard.TargetName="{x:Null}"
                    Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
                    FillBehavior="Stop">
                    <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_HardEdge_FadeOutStart}"
                        Value="1.0"/>
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_HardEdge_FadeOutEnd}"
                        Value="1.1"
                        EasingFunction="{local:LinearEasing}" />
                </DoubleAnimationUsingKeyFrames>
            </local:UIStoryboard>

            <local:UIStoryboard x:Key="A_Storyboard_SoftEdgeGlow">
                <DoubleAnimationUsingKeyFrames
                    Storyboard.TargetName="{x:Null}"
                    Storyboard.TargetProperty="(UIElement.Opacity)"
                    FillBehavior="Stop">
                    <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_SoftEdge_FadeInStart}"
                        Value="0.0"/>
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_SoftEdge_FadeInEnd}"
                        Value="0.6"
                        EasingFunction="{local:LinearEasing}" />
                    <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_SoftEdge_FadeOutStart}"
                        Value="0.6"/>
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_SoftEdge_FadeOutEnd}"
                        Value="0.0"
                        EasingFunction="{local:LinearEasing}" />
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames
                    Storyboard.TargetName="{x:Null}"
                    Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(ScaleTransform.ScaleX)"
                    FillBehavior="Stop">
                    <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_SoftEdge_FadeInStart}"
                        Value="1.0"/>
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_SoftEdge_FadeOutEnd}"
                        Value="1.85"
                        EasingFunction="{local:ExponentialEasing EasingMode=EaseIn}" />
                </DoubleAnimationUsingKeyFrames>
            </local:UIStoryboard>

            <Style x:Key="A_Style_ProgressBar_StuntPartyProgress_PlayerContribution"
                   TargetType="{x:Type ProgressBar}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ProgressBar}">
                            <DockPanel x:Name="PART_Track" Width="{StaticResource A_Double_MinorNotification_ContentsWidth}">
                                <Grid x:Name="PART_Indicator" ClipToBounds="True" HorizontalAlignment="Left" Width="{StaticResource A_Double_MinorNotification_ContentsWidth}">
                                    <local:FZMaterial Width="{StaticResource A_Double_MinorNotification_ContentsWidth}">
                                        <local:FZMaterial.Preset>
                                            <local:FZMaterialPresetRoundtangle BasedOn="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterRightOnly}"
                                                GradientColorA="{StaticResource A_Color_ForzathonLive_GradientA}"
                                                GradientColorB="{StaticResource A_Color_ForzathonLive_GradientB}"
                                                GradientAngle="90"/>
                                        </local:FZMaterial.Preset>
                                    </local:FZMaterial>
                                    <local:FZMaterial x:Name="BarFlashPanel"
                                        Opacity="0"
                                        Color="#FFFFFFFF"
                                        Width="{StaticResource A_Double_MinorNotification_ContentsWidth}">
                                        <local:FZMaterial.Preset>
                                            <local:FZMaterialPresetRoundtangle BasedOn="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterRightOnly}"
                                                AlphaMode="Additive"/>
                                        </local:FZMaterial.Preset>
                                    </local:FZMaterial>
                                </Grid>
                                <local:EventFire.FzTriggers>
                                    <local:EventFireTrigger Event="BarFlash">
                                        <local:EventFireTrigger.Storyboard>
                                            <local:UIStoryboard>
                                                <DoubleAnimationUsingKeyFrames
                                                    Storyboard.TargetName="BarFlashPanel"
                                                    Storyboard.TargetProperty="(UIElement.Opacity)"
                                                    FillBehavior="Stop">
                                                    <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Bar_FadeInStart}"
                                                        Value="0.0"/>
                                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Bar_FadeInEnd}"
                                                        Value="1.0"
                                                        EasingFunction="{local:LinearEasing}" />
                                                    <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Bar_FadeOutStart}"
                                                        Value="1.0"/>
                                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Bar_FadeOutEnd}"
                                                        Value="0.0"
                                                        EasingFunction="{local:LinearEasing}" />
                                                </DoubleAnimationUsingKeyFrames>
                                            </local:UIStoryboard>
                                        </local:EventFireTrigger.Storyboard>
                                    </local:EventFireTrigger>
                                </local:EventFire.FzTriggers>
                            </DockPanel>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <ExponentialEase x:Key="A_EasingFunction_ProgressBar_Background" EasingMode="EaseIn" />
            <ExponentialEase x:Key="A_EasingFunction_ProgressBar_Foreground" EasingMode="EaseIn" />
            <ExponentialEase x:Key="A_EasingFunction_ProgressBar_Background_PlayerContribution" EasingMode="EaseIn" />
            <ExponentialEase x:Key="A_EasingFunction_ProgressBar_Foreground_PlayerContribution" EasingMode="EaseIn" />

            <System:TimeSpan x:Key="A_TimeSpan_ProgressBar_ValueChangeDuration">0:0:1.0</System:TimeSpan>

            <KeyTime x:Key="A_KeyTime_ProgressBar_Background_ValueChangeStart">0:0:0.0</KeyTime>
            <KeyTime x:Key="A_KeyTime_ProgressBar_Foreground_ValueChangeStart">0:0:0.0</KeyTime>

            <local:OffsetKeyTime x:Key="A_KeyTime_ProgressBar_Background_ValueChangeEnd"
                KeyTime="{StaticResource A_KeyTime_ProgressBar_Background_ValueChangeStart}"
                Offset="{StaticResource A_TimeSpan_ProgressBar_ValueChangeDuration}"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_ProgressBar_Foreground_ValueChangeEnd"
                KeyTime="{StaticResource A_KeyTime_ProgressBar_Foreground_ValueChangeStart}"
                Offset="{StaticResource A_TimeSpan_ProgressBar_ValueChangeDuration}"/>

            <KeyTime x:Key="A_KeyTime_ProgressBar_Background_PlayerContribution_ValueChangeStart">0:0:0.0</KeyTime>
            <System:TimeSpan x:Key="A_TimeSpan_ProgressBar_Background_PlayerContribution_ValueChangeDelay">0:0:1.3</System:TimeSpan>

            <local:OffsetKeyTime x:Key="A_KeyTime_ProgressBar_Background_PlayerContribution_ValueChangeEnd"
                KeyTime="{StaticResource A_KeyTime_ProgressBar_Background_PlayerContribution_ValueChangeStart}"
                Offset="{StaticResource A_TimeSpan_ProgressBar_ValueChangeDuration}"/>

            <local:OffsetKeyTime x:Key="A_KeyTime_ProgressBar_Foreground_PlayerContribution_ValueChangeStart"
                KeyTime="{StaticResource A_KeyTime_ProgressBar_Background_PlayerContribution_ValueChangeEnd}"
                Offset="{StaticResource A_TimeSpan_ProgressBar_Background_PlayerContribution_ValueChangeDelay}"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_ProgressBar_Foreground_PlayerContribution_ValueChangeEnd"
                KeyTime="{StaticResource A_KeyTime_ProgressBar_Foreground_PlayerContribution_ValueChangeStart}"
                Offset="{StaticResource A_TimeSpan_ProgressBar_ValueChangeDuration}"/>

            <local:UIStoryboard x:Key="A_Storyboard_ProgressBar_Background_BlendValueInputChanged">
                <local:UIStoryboard.TriggerAnimation>
                    <!--<local:RaiseFzEvent Storyboard.TargetName="UserControl"
                        EventName="AnimBegin"
                        local:TriggerAnimation.KeyTime="0:0:0.0"/>-->
                    <local:RaiseFzEvent Storyboard.TargetName="UserControl"
                        EventName="AnimEnd"
                        local:TriggerAnimation.KeyTime="{StaticResource A_KeyTime_ProgressBar_Background_ValueChangeEnd}"/>
                </local:UIStoryboard.TriggerAnimation>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="{x:Null}"
                                               FillBehavior="Stop"
                                               Storyboard.TargetProperty="(local:BlendValue.Blend)">
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                            Value="0" />
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_ProgressBar_Background_ValueChangeStart}"
                                            Value="0" />
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_ProgressBar_Background_ValueChangeEnd}"
                                          Value="1"
                                          EasingFunction="{StaticResource A_EasingFunction_ProgressBar_Background}">
                    </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <StringAnimationUsingKeyFrames Storyboard.TargetProperty="(local:EventFire.EventName)" Storyboard.TargetName="AnimBeginEventFire">
                    <DiscreteStringKeyFrame KeyTime="0:0:0.0" Value="AnimBegin"/>
                    <DiscreteStringKeyFrame KeyTime="0:0:0.33" Value=""/>
                </StringAnimationUsingKeyFrames>
            </local:UIStoryboard>

            <local:UIStoryboard x:Key="A_Storyboard_ProgressBar_Background_PlayerContribution_BlendValueInputChanged">
                <local:UIStoryboard.TriggerAnimation>
                    <!--<local:RaiseFzEvent Storyboard.TargetName="UserControl"
                        EventName="AnimBegin"
                        local:TriggerAnimation.KeyTime="0:0:0.0"/>-->
                    <local:RaiseFzEvent Storyboard.TargetName="ProgressBar_Background"
                        EventName="BarFlash"
                        local:TriggerAnimation.KeyTime="{StaticResource A_KeyTime_ProgressBar_Background_PlayerContribution_ValueChangeEnd}"/>
                    <local:RaiseFzEvent Storyboard.TargetName="HardEdgeGlow"
                        EventName="BarFlash"
                        local:TriggerAnimation.KeyTime="{StaticResource A_KeyTime_ProgressBar_Background_PlayerContribution_ValueChangeEnd}"/>
                    <local:RaiseFzEvent Storyboard.TargetName="SoftEdgeGlow"
                        EventName="BarFlash"
                        local:TriggerAnimation.KeyTime="{StaticResource A_KeyTime_ProgressBar_Background_PlayerContribution_ValueChangeEnd}"/>
                    <local:RaiseFzEvent Storyboard.TargetName="UserControl"
                        EventName="AnimEnd"
                        local:TriggerAnimation.KeyTime="{StaticResource A_KeyTime_ProgressBar_Foreground_PlayerContribution_ValueChangeEnd}"/>
                </local:UIStoryboard.TriggerAnimation>
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="{x:Null}"
                                               FillBehavior="Stop"
                                               Storyboard.TargetProperty="(local:BlendValue.Blend)">
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                            Value="0" />
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_ProgressBar_Background_PlayerContribution_ValueChangeStart}"
                                            Value="0" />
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_ProgressBar_Background_PlayerContribution_ValueChangeEnd}"
                                          Value="1"
                                          EasingFunction="{StaticResource A_EasingFunction_ProgressBar_Background_PlayerContribution}">
                    </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
                <StringAnimationUsingKeyFrames Storyboard.TargetProperty="(local:EventFire.EventName)" Storyboard.TargetName="AnimBeginEventFire">
                    <DiscreteStringKeyFrame KeyTime="0:0:0.0" Value="AnimBegin"/>
                    <DiscreteStringKeyFrame KeyTime="0:0:0.33" Value=""/>
                </StringAnimationUsingKeyFrames>
            </local:UIStoryboard>

            <local:MappingConverter x:Key="A_Converter_BooleanToBackgroundBlendValueChangedStoryboard"
                                Default="{StaticResource A_Storyboard_ProgressBar_Background_BlendValueInputChanged}">
                <local:MappingConverterEntry Key="{StaticResource A_Boolean_True}"
                                             Value="{StaticResource A_Storyboard_ProgressBar_Background_PlayerContribution_BlendValueInputChanged}" />
            </local:MappingConverter>

            <local:UIStoryboard x:Key="A_Storyboard_ProgressBar_Foreground_BlendValueInputChanged">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="{x:Null}"
                                               FillBehavior="Stop"
                                               Storyboard.TargetProperty="(local:BlendValue.Blend)">
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                            Value="0" />
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_ProgressBar_Foreground_ValueChangeStart}"
                                            Value="0" />
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_ProgressBar_Foreground_ValueChangeEnd}"
                                          Value="1"
                                          EasingFunction="{StaticResource A_EasingFunction_ProgressBar_Foreground}">
                    </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
            </local:UIStoryboard>

            <local:UIStoryboard x:Key="A_Storyboard_ProgressBar_Foreground_PlayerContribution_BlendValueInputChanged">
                <DoubleAnimationUsingKeyFrames Storyboard.TargetName="{x:Null}"
                                               FillBehavior="Stop"
                                               Storyboard.TargetProperty="(local:BlendValue.Blend)">
                    <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                            Value="0" />
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_ProgressBar_Foreground_PlayerContribution_ValueChangeStart}"
                                            Value="0" />
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_ProgressBar_Foreground_PlayerContribution_ValueChangeEnd}"
                                          Value="1"
                                          EasingFunction="{StaticResource A_EasingFunction_ProgressBar_Foreground_PlayerContribution}">
                    </EasingDoubleKeyFrame>
                </DoubleAnimationUsingKeyFrames>
            </local:UIStoryboard>

            <local:MappingConverter x:Key="A_Converter_BooleanToForegroundBlendValueChangedStoryboard"
                                Default="{StaticResource A_Storyboard_ProgressBar_Foreground_BlendValueInputChanged}">
                <local:MappingConverterEntry Key="{StaticResource A_Boolean_True}"
                                             Value="{StaticResource A_Storyboard_ProgressBar_Foreground_PlayerContribution_BlendValueInputChanged}" />
            </local:MappingConverter>

            <KeyTime x:Key="A_KeyTime_NotificationShowAnimation">0:0:0.133</KeyTime>
            <Duration x:Key="A_Duration_NotificationShowAnimation">0:0:0.133</Duration>
            <KeyTime x:Key="A_KeyTime_NotificationHideAnimation">0:0:0.133</KeyTime>
            <Duration x:Key="A_Duration_NotificationHideAnimation">0:0:0.133</Duration>

            <ExponentialEase x:Key="A_EasingFunction_EaseIn" EasingMode="EaseIn"/>
            <ExponentialEase x:Key="A_EasingFunction_EaseOut" EasingMode="EaseOut"/>

        </ResourceDictionary>
    </UserControl.Resources>

    <StackPanel x:Name="LayoutRoot"
        Orientation="Vertical"
        HorizontalAlignment="Center">
                <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="VisualStateGroup">
                <VisualState x:Name="Hidden">
                    <Storyboard>
                         <DoubleAnimationUsingKeyFrames Duration="{StaticResource A_Duration_NotificationHideAnimation}" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="LayoutRoot">
                            <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
                            <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_NotificationHideAnimation}" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Duration="{StaticResource A_Duration_NotificationHideAnimation}" Storyboard.TargetProperty="(local:ZPanel.Transform).(Transform3DGroup.Children)[0].(RotateTransform3D.Rotation).(AxisAngleRotation3D.Angle)" Storyboard.TargetName="FlippingControl">
                            <DiscreteDoubleKeyFrame KeyTime="0" Value="0"/>
                            <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_NotificationHideAnimation}" Value="-80" EasingFunction="{StaticResource A_EasingFunction_EaseOut}"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Duration="{StaticResource A_Duration_NotificationHideAnimation}" Storyboard.TargetProperty="(UIElement.Opacity)"  Storyboard.TargetName="Title">
                            <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
                            <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_NotificationHideAnimation}" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                        <StringAnimationUsingKeyFrames Storyboard.TargetProperty="(local:EventFire.EventName)" Storyboard.TargetName="EventFire">
                            <DiscreteStringKeyFrame KeyTime="0:0:0.15" Value=""/>
                            <DiscreteStringKeyFrame KeyTime="0:0:0.2" Value="HiddenComplete"/>
                        </StringAnimationUsingKeyFrames>
                        <!-- Audio (Minor Off) -->
                        <StringAnimationUsingKeyFrames Storyboard.TargetProperty="(local:AudioEvent.SoundName)" Storyboard.TargetName="MinorOffAudioEvent">
                            <DiscreteStringKeyFrame KeyTime="0:0:0.0" Value="" />
                            <DiscreteStringKeyFrame KeyTime="0:0:0.01" Value="/Master/UI/Notification/HZ3_SFX_HUD_Notification_MinorOff_01" />
                        </StringAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
                <VisualState x:Name="Shown">
                    <Storyboard>
                        <DoubleAnimationUsingKeyFrames Duration="{StaticResource A_Duration_NotificationShowAnimation}" Storyboard.TargetProperty="(local:ZPanel.Transform).(Transform3DGroup.Children)[0].(RotateTransform3D.Rotation).(AxisAngleRotation3D.Angle)" Storyboard.TargetName="FlippingControl">
                            <DiscreteDoubleKeyFrame KeyTime="0" Value="90"/>
                            <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_NotificationShowAnimation}" Value="0" EasingFunction="{StaticResource A_EasingFunction_EaseIn}"/>
                        </DoubleAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Duration="{StaticResource A_Duration_NotificationShowAnimation}"  Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.Y)" Storyboard.TargetName="Title">
                            <DiscreteDoubleKeyFrame KeyTime="0:0:0.0" Value="-36" />
                            <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_NotificationShowAnimation}" Value="0" EasingFunction="{local:PowerEasing EasingMode=EaseOut}"/>
                        </DoubleAnimationUsingKeyFrames>
                        <StringAnimationUsingKeyFrames Storyboard.TargetProperty="(local:EventFire.EventName)" Storyboard.TargetName="EventFire">
                            <DiscreteStringKeyFrame KeyTime="0:0:3.6" Value=""/>
                            <DiscreteStringKeyFrame KeyTime="0:0:3.7" Value="ShownComplete"/>
                        </StringAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Decorator ClipToBounds="True" Height="36">
            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_HudMedium}"
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                Text="{local:Loc InGame.IDS_StuntParty_GroupProgress}"
                x:Name="Title">
                <local:FZTextBlock.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <TranslateTransform/>
                    </TransformGroup>
                </local:FZTextBlock.RenderTransform>
            </local:FZTextBlock>
        </Decorator>

        <Grid x:Name="FlippingControl"
            Style="{StaticResource A_Style_FrameworkElement_Notification}"
            RenderTransformOrigin="0.5,0.5">
            <DockPanel Height="{StaticResource A_Double_MinorNotification_Height}">
                <local:FZMaterial DockPanel.Dock="Right"
                    Width="{StaticResource A_Double_MinorNotification_ContentsWidth}"
                    Color="{StaticResource A_Color_GlassPanel_NonInteractive}"
                    Preset="{StaticResource A_FZMaterialPresetGlassRoundtangle_GlassPanel_OuterRightOnly}"
                    Margin="-0.5,0,0,0">
                    <Grid>
                        <ProgressBar x:Name="ProgressBar_Background"
                            Style="{StaticResource A_Style_ProgressBar_StuntPartyProgress_PlayerContribution}"
                            Minimum="0"
                            Maximum="{Binding TargetScore}"
                            local:BlendValue.Input="{Binding CurrentScore}"
                            local:BlendValue.InputChangedStoryboard="{Binding IsLocalPlayerContribution, Converter={StaticResource A_Converter_BooleanToBackgroundBlendValueChangedStoryboard}}"
                            Value="{Binding Path=(local:BlendValue.Output), RelativeSource={RelativeSource Self}}"/>
                        <ProgressBar x:Name="ProgressBar_Foreground"
                            Style="{StaticResource A_Style_ProgressBar_StuntPartyProgress}"
                            Minimum="0"
                            Maximum="{Binding TargetScore}"
                            local:BlendValue.Input="{Binding CurrentScore}"
                            local:BlendValue.InputChangedStoryboard="{Binding IsLocalPlayerContribution, Converter={StaticResource A_Converter_BooleanToForegroundBlendValueChangedStoryboard}}"
                            Value="{Binding Path=(local:BlendValue.Output), RelativeSource={RelativeSource Self}}"/>
                        <local:FZTextBlock Style="{StaticResource A_Style_Text_CurrentScore}"
                            local:BindingProxy.AlwaysValidNumeric="{Binding (local:BlendValue.Output), ElementName=ProgressBar_Background}"/>
                    </Grid>
                </local:FZMaterial>
                <local:FZMaterial DockPanel.Dock="Left"
                    Width="{StaticResource A_Double_MinorNotification_Height}"
                    Height="{StaticResource A_Double_MinorNotification_Height}"
                    ImageSource="/ForzaUI;component/Textures/Data_Bound/HUD/StuntParty/Notification_StuntParty_Backing.png">
                    <local:FZMaterial Margin="-40"
                        Width="94"
                        Height="76"
                        ImageSource="/ForzaUI;component/Textures/Data_Bound/HUD/StuntParty/Notification_StuntParty.png"/>
                </local:FZMaterial>
            </DockPanel>

            <local:FZMaterial x:Name="HardEdgeGlow"
                Opacity="0"
                Color="#FFFFFFFF"
                RenderTransformOrigin="0.5,0.5"
                Margin="-4">
                <local:FZMaterial.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform ScaleX="1" ScaleY="{Binding ScaleX, RelativeSource={RelativeSource Self}}"/>
                    </TransformGroup>
                </local:FZMaterial.RenderTransform>
                <local:FZMaterial.Preset>
                    <local:FZMaterialPresetRoundtangle BasedOn="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}"
                        AlphaMode="Additive"
                        Softness="4"
                        CornerRadius="12"/>
                </local:FZMaterial.Preset>
                <local:EventFire.FzTriggers>
                    <local:EventFireTrigger Event="BarFlash"
                        Storyboard="{StaticResource A_Storyboard_HardEdgeGlow}"/>
                </local:EventFire.FzTriggers>
            </local:FZMaterial>

            <local:FZMaterial x:Name="SoftEdgeGlow"
                Width="256"
                Height="256"
                Margin="-128"
                Opacity="0"
                Color="#FFFFFFFF"
                RenderTransformOrigin="0.5,0.5">
                <local:FZMaterial.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform ScaleX="2.25" ScaleY="0.2"/>
                        <ScaleTransform ScaleX="1" ScaleY="{Binding ScaleX, RelativeSource={RelativeSource Self}}"/>
                    </TransformGroup>
                </local:FZMaterial.RenderTransform>
                <local:FZMaterial.Preset>
                    <local:FZMaterialPresetRoundtangle BasedOn="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll}"
                        AlphaMode="Additive"
                        Softness="128"/>
                </local:FZMaterial.Preset>
                <local:EventFire.FzTriggers>
                    <local:EventFireTrigger Event="BarFlash"
                        Storyboard="{StaticResource A_Storyboard_SoftEdgeGlow}"/>
                </local:EventFire.FzTriggers>
            </local:FZMaterial>
        </Grid>

        <local:EventFire x:Name="EventFire" />
        <local:EventFire x:Name="AnimBeginEventFire" />

        <!-- Audio Events -->
        <local:AudioEvent x:Name="MinorOffAudioEvent" />
    </StackPanel>
</UserControl>