<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.HUDBrickChallengeCompletedControl"
    x:Name="UserControl"
    Margin="0,162,0,0"
    VerticalAlignment="Top">

    <UserControl.Resources>
        <ResourceDictionary>
            <ImageSource x:Key="A_BitmapImage_Brick">/ForzaUI;component/Textures/Data_Bound/PDLC2/BrickChallenges/HUD/Gold_Brick.png</ImageSource>
            <ImageSource x:Key="A_BitmapImage_Brick_Silhouette">/ForzaUI;component/Textures/Data_Bound/PDLC2/BrickChallenges/HUD/Gold_Brick_Silhouette.png</ImageSource>
            <ImageSource x:Key="A_BitmapImage_Brick_Glow">/ForzaUI;component/Textures/Data_Bound/PDLC2/BrickChallenges/HUD/Gold_Brick_Glow.png</ImageSource>
            <ImageSource x:Key="A_BitmapImage_Brick_Gradient">/ForzaUI;component/Textures/Data_Bound/PDLC2/TextureMaskGradients/Completed_Brick_Gradient.png</ImageSource>
            <ImageSource x:Key="A_BitmapImage_Gradient">/ForzaUI;component/Textures/Data_Bound/PDLC2/BrickChallenges/HUD/Gradient.png</ImageSource>

            <System:Double x:Key="A_Double_TransformAngle">8.25</System:Double>
            <local:LinearTransformConverter x:Key="A_Converter_Negate" Scale="-1"/>

            <System:Double x:Key="A_Double_BrickSheen_Start">0.2</System:Double>
            <System:Double x:Key="A_Double_BrickSheen_End">0.8</System:Double>
            <System:Double x:Key="A_Double_BrickSheen_InnerRadius">0.025</System:Double>
            <System:Double x:Key="A_Double_BrickSheen_OuterRadius">0.125</System:Double>

            <local:LinearTransformConverter x:Key="A_Converter_BrickSheen_FadeInStart"
                Sub="{StaticResource A_Double_BrickSheen_OuterRadius}"/>
            <local:LinearTransformConverter x:Key="A_Converter_BrickSheen_FadeInEnd"
                Sub="{StaticResource A_Double_BrickSheen_InnerRadius}"/>
            <local:LinearTransformConverter x:Key="A_Converter_BrickSheen_FadeOutStart"
                Add="{StaticResource A_Double_BrickSheen_InnerRadius}"/>
            <local:LinearTransformConverter x:Key="A_Converter_BrickSheen_FadeOutEnd"
                Add="{StaticResource A_Double_BrickSheen_OuterRadius}"/>

            <System:TimeSpan x:Key="A_Duration_BrickSheen">0:0:0.5</System:TimeSpan>
            <KeyTime x:Key="A_KeyTime_BrickSheen_Start">0:0:0.0</KeyTime>
            <local:OffsetKeyTime x:Key="A_KeyTime_BrickSheen_End"
                KeyTime="{StaticResource A_KeyTime_BrickSheen_Start}"
                Offset="{StaticResource A_Duration_BrickSheen}"/>

            <System:Double x:Key="A_Double_BrickPulse_Default">0.825</System:Double>
            <System:Double x:Key="A_Double_BrickPulse_Max">1.03</System:Double>
            <System:Double x:Key="A_Double_BrickPulse_Min">0.7</System:Double>

            <System:TimeSpan x:Key="A_Duration_BrickPulse_ExpandToMax">0:0:0.1</System:TimeSpan>
            <System:TimeSpan x:Key="A_Duration_BrickPulse_ShrinkToMin">0:0:0.2</System:TimeSpan>
            <System:TimeSpan x:Key="A_Duration_BrickPulse_ReturnToDefault">0:0:0.1</System:TimeSpan>
            <KeyTime x:Key="A_KeyTime_BrickPulse_Start">0:0:0.15</KeyTime>
            <local:OffsetKeyTime x:Key="A_KeyTime_BrickPulse_ExpandToMax"
                KeyTime="{StaticResource A_KeyTime_BrickPulse_Start}"
                Offset="{StaticResource A_Duration_BrickPulse_ExpandToMax}"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_BrickPulse_ShrinkToMin"
                KeyTime="{StaticResource A_KeyTime_BrickPulse_ExpandToMax}"
                Offset="{StaticResource A_Duration_BrickPulse_ShrinkToMin}"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_BrickPulse_ReturnToDefault"
                KeyTime="{StaticResource A_KeyTime_BrickPulse_ShrinkToMin}"
                Offset="{StaticResource A_Duration_BrickPulse_ReturnToDefault}"/>

            <System:Double x:Key="A_Double_BrickGlow_MaxOpacity">0.1</System:Double>
            <System:TimeSpan x:Key="A_Duration_BrickGlow_FadeIn">0:0:0.175</System:TimeSpan>
            <System:TimeSpan x:Key="A_Duration_BrickGlow_FadeOutDelay">0:0:0.0</System:TimeSpan>
            <System:TimeSpan x:Key="A_Duration_BrickGlow_FadeOut">0:0:0.175</System:TimeSpan>
            <KeyTime x:Key="A_KeyTime_BrickGlow_StartFadeIn">0:0:0.15</KeyTime>
            <local:OffsetKeyTime x:Key="A_KeyTime_BrickGlow_EndFadeIn"
                KeyTime="{StaticResource A_KeyTime_BrickGlow_StartFadeIn}"
                Offset="{StaticResource A_Duration_BrickGlow_FadeIn}"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_BrickGlow_StartFadeOut"
                KeyTime="{StaticResource A_KeyTime_BrickGlow_EndFadeIn}"
                Offset="{StaticResource A_Duration_BrickGlow_FadeOutDelay}"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_BrickGlow_End_FadeOut"
                KeyTime="{StaticResource A_KeyTime_BrickGlow_StartFadeOut}"
                Offset="{StaticResource A_Duration_BrickGlow_FadeOut}"/>

            <local:UIStoryboard x:Key="A_Storyboard_BrickFlash">
                <DoubleAnimationUsingKeyFrames
                    Storyboard.TargetName="BrickPulse"
                    Storyboard.TargetProperty="(local:BindingProxy.A)"
                    FillBehavior="Stop">
                    <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_BrickPulse_Start}"
                        Value="{StaticResource A_Double_BrickPulse_Default}"/>
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_BrickPulse_ExpandToMax}"
                        Value="{StaticResource A_Double_BrickPulse_Max}"
                        EasingFunction="{local:CircleEasing EasingMode=EaseOut}" />
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_BrickPulse_ShrinkToMin}"
                        Value="{StaticResource A_Double_BrickPulse_Min}"
                        EasingFunction="{local:CircleEasing EasingMode=EaseInOut}"/>
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_BrickPulse_ReturnToDefault}"
                        Value="{StaticResource A_Double_BrickPulse_Default}"
                        EasingFunction="{local:CircleEasing EasingMode=EaseIn}" />
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames
                    Storyboard.TargetName="BrickSheen"
                    Storyboard.TargetProperty="(local:BindingProxy.A)"
                    FillBehavior="Stop">
                    <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_BrickSheen_Start}"
                        Value="{StaticResource A_Double_BrickSheen_Start}"/>
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_BrickSheen_End}"
                        Value="{StaticResource A_Double_BrickSheen_End}"
                        EasingFunction="{local:QuadraticEasing EasingMode=EaseIn}" />
                </DoubleAnimationUsingKeyFrames>
                <ObjectAnimationUsingKeyFrames
                    Storyboard.TargetName="BrickSheenContainer"
                    Storyboard.TargetProperty="CaptureSubgraph"
                    FillBehavior="Stop">
                    <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_BrickSheen_Start}" Value="{StaticResource A_Boolean_True}"/>
                    <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_BrickSheen_End}" Value="{StaticResource A_Boolean_False}"/>
                </ObjectAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames
                    Storyboard.TargetName="BrickSheenContainer"
                    Storyboard.TargetProperty="(UIElement.Opacity)"
                    FillBehavior="Stop">
                    <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_BrickSheen_Start}"
                        Value="1.0"/>
                    <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_BrickSheen_End}"
                        Value="0.0"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames
                    Storyboard.TargetName="BrickGlow"
                    Storyboard.TargetProperty="(UIElement.Opacity)"
                    FillBehavior="Stop">
                    <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_BrickGlow_StartFadeIn}"
                        Value="0.0"/>
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_BrickGlow_EndFadeIn}"
                        Value="{StaticResource A_Double_BrickGlow_MaxOpacity}"
                        EasingFunction="{local:LinearEasing}" />
                    <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_BrickGlow_StartFadeOut}"
                        Value="{StaticResource A_Double_BrickGlow_MaxOpacity}"/>
                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_BrickGlow_End_FadeOut}"
                        Value="0.0"
                        EasingFunction="{local:LinearEasing}" />
                </DoubleAnimationUsingKeyFrames>
            </local:UIStoryboard>

            <Style x:Key="A_Style_Markup_BrickChallengeCompleted_BRICK"
                TargetType="{x:Type Control}">
                <Setter Property="Margin" Value="-63,-59,-65,-41"/>
                <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
                <Setter Property="RenderTransform">
                    <Setter.Value>
                        <TransformGroup>
                            <SkewTransform AngleX="{StaticResource A_Double_TransformAngle}"/>
                            <RotateTransform Angle="{StaticResource A_Double_TransformAngle}"/>
                        </TransformGroup>
                    </Setter.Value>
                </Setter>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Control}">
                            <Grid x:Name="BrickPulse" Width="184" Height="138" RenderTransformOrigin="0.5,0.5" local:BindingProxy.A="{StaticResource A_Double_BrickPulse_Default}">
                                <Grid.RenderTransform>
                                    <ScaleTransform ScaleX="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource AncestorType=FrameworkElement}}" ScaleY="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource AncestorType=FrameworkElement}}"/>
                                </Grid.RenderTransform>
                                <local:FZMaterial x:Name="BrickGlow" ImageSource="{StaticResource A_BitmapImage_Brick_Glow}" Opacity="0.0" Preset="{StaticResource A_FZMaterialPresetAdditive}"/>
                                <local:FZMaterial ImageSource="{StaticResource A_BitmapImage_Brick}"/>

                                <local:FZMaterial x:Name="BrickSheenContainer" CaptureSubgraph="False" Opacity="0" Preset="{StaticResource A_FZMaterialPresetAdditive}">
                                    <local:FZMaterial x:Name="BrickSheen"
                                        local:BindingProxy.A="{StaticResource A_Double_BrickSheen_Start}">
                                        <local:FZMaterial.Effect>
                                            <local:TextureMaskEffect
                                                FadeInStart="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource AncestorType={x:Type local:FZMaterial}}, Converter={StaticResource A_Converter_BrickSheen_FadeInStart}}"
                                                FadeInEnd="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource AncestorType={x:Type local:FZMaterial}}, Converter={StaticResource A_Converter_BrickSheen_FadeInEnd}}"
                                                FadeOutStart="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource AncestorType={x:Type local:FZMaterial}}, Converter={StaticResource A_Converter_BrickSheen_FadeOutStart}}"
                                                FadeOutEnd="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource AncestorType={x:Type local:FZMaterial}}, Converter={StaticResource A_Converter_BrickSheen_FadeOutEnd}}">
                                                <local:TextureMaskEffect.Texture>
                                                    <ImageBrush ImageSource="{StaticResource A_BitmapImage_Brick_Silhouette}"/>
                                                </local:TextureMaskEffect.Texture>
                                                <local:TextureMaskEffect.Mask>
                                                    <ImageBrush ImageSource="{StaticResource A_BitmapImage_Brick_Gradient}"/>
                                                </local:TextureMaskEffect.Mask>
                                            </local:TextureMaskEffect>
                                        </local:FZMaterial.Effect>
                                    </local:FZMaterial>
                                </local:FZMaterial>

                            </Grid>
                            <ControlTemplate.Triggers>
                                <DataTrigger Binding="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource AncestorType={x:Type local:FZTextBlock}}, FallbackValue={StaticResource A_Boolean_False}}" Value="{StaticResource A_Boolean_True}">
                                    <DataTrigger.EnterActions>
                                        <local:BeginUIStoryboard Storyboard="{StaticResource A_Storyboard_BrickFlash}"/>
                                    </DataTrigger.EnterActions>
                                </DataTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="A_Style_Markup_BrickChallengeCompleted_ACTIVATE"
                TargetType="{x:Type Control}">
                <Setter Property="Margin" Value="0,0,0,-4"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Control}">
                            <local:ControllerButtonControl Height="38"
                                Style="{StaticResource A_Style_ControllerButtonControl_ActivationButton}" 
                                UseLargeIcon="True"/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <System:Double x:Key="A_Double_Positive">1200</System:Double>
            <System:Double x:Key="A_Double_Neutral">0</System:Double>
            <System:Double x:Key="A_Double_Negative">-1200</System:Double>

            <CircleEase x:Key="A_SlideInEase" EasingMode="EaseOut" />
            <CircleEase x:Key="A_SlideOutEase" EasingMode="EaseIn" />

            <System:TimeSpan x:Key="A_Duration_Lines_SlideIn">0:0:0.2</System:TimeSpan>
            <System:TimeSpan x:Key="A_Duration_Lines_SlideOut">0:0:0.2</System:TimeSpan>
            <System:TimeSpan x:Key="A_Duration_Activation_FadeIn">-0:0:0.1</System:TimeSpan>
            <System:TimeSpan x:Key="A_Duration_Activation_FadeOut">0:0:0.1</System:TimeSpan>
            <System:TimeSpan x:Key="A_Duration_ShownComplete_Delay">0:0:3.4</System:TimeSpan>
            <System:TimeSpan x:Key="A_Duration_BrickFlash_Delay">0:0:0.2</System:TimeSpan>

            <KeyTime x:Key="A_KeyTime_Lines_SlideInStart">0:0:0.0</KeyTime>
            <local:OffsetKeyTime x:Key="A_KeyTime_Lines_SlideInEnd"
                KeyTime="{StaticResource A_KeyTime_Lines_SlideInStart}"
                Offset="{StaticResource A_Duration_Lines_SlideIn}"/>

            <KeyTime x:Key="A_KeyTime_Lines_SlideOutStart">0:0:0.0</KeyTime>
            <local:OffsetKeyTime x:Key="A_KeyTime_Lines_SlideOutEnd"
                KeyTime="{StaticResource A_KeyTime_Lines_SlideOutStart}"
                Offset="{StaticResource A_Duration_Lines_SlideOut}"/>

            <local:OffsetKeyTime x:Key="A_KeyTime_Activation_FadeInEnd"
                KeyTime="{StaticResource A_KeyTime_Lines_SlideInEnd}"
                Offset="0:0:0.0"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_Activation_FadeInStart"
                KeyTime="{StaticResource A_KeyTime_Activation_FadeInEnd}"
                Offset="{StaticResource A_Duration_Activation_FadeIn}"/>

            <local:OffsetKeyTime x:Key="A_KeyTime_Activation_FadeOutStart"
                KeyTime="{StaticResource A_KeyTime_Lines_SlideOutStart}"
                Offset="0:0:0.0"/>
            <local:OffsetKeyTime x:Key="A_KeyTime_Activation_FadeOutEnd"
                KeyTime="{StaticResource A_KeyTime_Activation_FadeOutStart}"
                Offset="{StaticResource A_Duration_Activation_FadeOut}"/>

            <local:OffsetKeyTime x:Key="A_KeyTime_ShownComplete"
                KeyTime="{StaticResource A_KeyTime_Lines_SlideInEnd}"
                Offset="{StaticResource A_Duration_ShownComplete_Delay}"/>

            <local:OffsetKeyTime x:Key="A_KeyTime_BrickFlash"
                KeyTime="{StaticResource A_KeyTime_Lines_SlideInEnd}"
                Offset="{StaticResource A_Duration_BrickFlash_Delay}"/>

            <local:OffsetKeyTime x:Key="A_KeyTime_HiddenComplete"
                KeyTime="{StaticResource A_KeyTime_Lines_SlideOutEnd}"
                Offset="0:0:0.0"/>

            <System:Boolean x:Key="A_MotionBlur_Disabled">False</System:Boolean>
            <System:Boolean x:Key="A_MotionBlur_Enabled">True</System:Boolean>

            <Style x:Key="A_Style_FrameworkElement_HorizontalSlideMotionBlurContainer"
                TargetType="{x:Type FrameworkElement}">
                <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
                <Setter Property="local:BindingProxy.A" Value="{StaticResource A_Double_Neutral}" />
                <Setter Property="local:BindingProxy.B" Value="{StaticResource A_MotionBlur_Disabled}" />
                <Setter Property="RenderTransform">
                    <Setter.Value>
                        <TransformGroup>
                            <TranslateTransform X="{Binding Path=(local:BindingProxy.A), RelativeSource={RelativeSource AncestorType=FrameworkElement}}"/>
                        </TransformGroup>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding (local:BindingProxy.B), FallbackValue={StaticResource A_MotionBlur_Disabled}, RelativeSource={RelativeSource Self}}" Value="{StaticResource A_MotionBlur_Enabled}">
                        <Setter Property="Effect" Value="{StaticResource A_MotionBlurEffect}"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </ResourceDictionary>
    </UserControl.Resources>

    <DockPanel x:Name="LayoutRoot" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5">
        <DockPanel.RenderTransform>
            <TransformGroup>
                <RotateTransform Angle="{Binding Source={StaticResource A_Double_TransformAngle}, Converter={StaticResource A_Converter_Negate}}"/>
                <SkewTransform AngleX="{Binding Source={StaticResource A_Double_TransformAngle}, Converter={StaticResource A_Converter_Negate}}"/>
            </TransformGroup>
        </DockPanel.RenderTransform>

        <VisualStateManager.VisualStateGroups>
            <local:UIVisualStateGroup x:Name="VisualStateGroup">
                <VisualState x:Name="Hidden">
                    <local:UIStoryboard>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="TopLine">
                            <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>

                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="BottomLine">
                            <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>

                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ActivationLine">
                            <EasingDoubleKeyFrame KeyTime="0:0:0.0" Value="0"/>
                        </DoubleAnimationUsingKeyFrames>
                    </local:UIStoryboard>
                </VisualState>
                <VisualState x:Name="Shown"/>
                <local:UIVisualStateGroup.Transitions>
                    <VisualTransition To="Shown">
                        <VisualTransition.Storyboard>
                            <local:UIStoryboard>
                                <local:UIStoryboard.TriggerAnimation>
                                    <local:StartAudioTrigger local:TriggerAnimation.KeyTime="0:0:0.0" EventName="AudioUITrigger_Red_Challenge_Complete_On"/>
                                    <local:RaiseFzEvent local:TriggerAnimation.KeyTime="{StaticResource A_KeyTime_ShownComplete}" EventName="ShownComplete"/>
                                </local:UIStoryboard.TriggerAnimation>

                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(local:BindingProxy.A)" Storyboard.TargetName="TopLine">
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideInStart}" Value="{StaticResource A_Double_Positive}"/>
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideInEnd}" Value="{StaticResource A_Double_Neutral}" EasingFunction="{StaticResource A_SlideInEase}"/>
                                </DoubleAnimationUsingKeyFrames>

                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(local:BindingProxy.B)"
                                    Storyboard.TargetName="TopLine" FillBehavior="Stop">
                                    <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideInStart}" Value="{StaticResource A_MotionBlur_Enabled}"/>
                                    <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideInEnd}" Value="{StaticResource A_MotionBlur_Disabled}"/>
                                </ObjectAnimationUsingKeyFrames>

                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="TopLine">
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideInStart}" Value="0"/>
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideInEnd}" Value="1"/>
                                </DoubleAnimationUsingKeyFrames>

                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(local:BindingProxy.A)" Storyboard.TargetName="BottomLine">
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideInStart}" Value="{StaticResource A_Double_Negative}"/>
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideInEnd}" Value="{StaticResource A_Double_Neutral}" EasingFunction="{StaticResource A_SlideInEase}"/>
                                </DoubleAnimationUsingKeyFrames>

                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(local:BindingProxy.B)"
                                    Storyboard.TargetName="BottomLine" FillBehavior="Stop">
                                    <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideInStart}" Value="{StaticResource A_MotionBlur_Enabled}"/>
                                    <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideInEnd}" Value="{StaticResource A_MotionBlur_Disabled}"/>
                                </ObjectAnimationUsingKeyFrames>

                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="BottomLine">
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideInStart}" Value="0"/>
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideInEnd}" Value="1"/>
                                </DoubleAnimationUsingKeyFrames>

                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ActivationLine">
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Activation_FadeInStart}" Value="0"/>
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Activation_FadeInEnd}" Value="1"/>
                                </DoubleAnimationUsingKeyFrames>

                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(local:BindingProxy.A)" Storyboard.TargetName="TopLineText" FillBehavior="Stop">
                                    <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_BrickFlash}" Value="{StaticResource A_Boolean_True}"/>
                                    <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_ShownComplete}" Value="{StaticResource A_Boolean_False}"/>
                                </ObjectAnimationUsingKeyFrames>
                            </local:UIStoryboard>
                        </VisualTransition.Storyboard>
                    </VisualTransition>
                    <VisualTransition To="Hidden">
                        <VisualTransition.Storyboard>
                            <local:UIStoryboard>
                                <local:UIStoryboard.TriggerAnimation>
                                    <local:StartAudioTrigger local:TriggerAnimation.KeyTime="0:0:0.0" EventName="AudioUITrigger_Red_Challenge_Complete_Off"/>
                                    <local:RaiseFzEvent local:TriggerAnimation.KeyTime="{StaticResource A_KeyTime_HiddenComplete}" EventName="HiddenComplete"/>
                                </local:UIStoryboard.TriggerAnimation>

                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(local:BindingProxy.A)" Storyboard.TargetName="TopLine">
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideOutStart}" Value="{StaticResource A_Double_Neutral}"/>
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideOutEnd}" Value="{StaticResource A_Double_Negative}" EasingFunction="{StaticResource A_SlideOutEase}"/>
                                </DoubleAnimationUsingKeyFrames>

                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(local:BindingProxy.B)"
                                    Storyboard.TargetName="TopLine" FillBehavior="Stop">
                                    <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideOutStart}" Value="{StaticResource A_MotionBlur_Enabled}"/>
                                    <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideOutEnd}" Value="{StaticResource A_MotionBlur_Disabled}"/>
                                </ObjectAnimationUsingKeyFrames>

                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="TopLine">
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideOutStart}" Value="1"/>
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideOutEnd}" Value="0"/>
                                </DoubleAnimationUsingKeyFrames>

                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(local:BindingProxy.A)" Storyboard.TargetName="BottomLine">
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideOutStart}" Value="{StaticResource A_Double_Neutral}"/>
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideOutEnd}" Value="{StaticResource A_Double_Positive}" EasingFunction="{StaticResource A_SlideOutEase}"/>
                                </DoubleAnimationUsingKeyFrames>

                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(local:BindingProxy.B)"
                                    Storyboard.TargetName="BottomLine" FillBehavior="Stop">
                                    <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideOutStart}" Value="{StaticResource A_MotionBlur_Enabled}"/>
                                    <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideOutEnd}" Value="{StaticResource A_MotionBlur_Disabled}"/>
                                </ObjectAnimationUsingKeyFrames>

                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="BottomLine">
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideOutStart}" Value="1"/>
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Lines_SlideOutEnd}" Value="0"/>
                                </DoubleAnimationUsingKeyFrames>

                                <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ActivationLine">
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Activation_FadeOutStart}" Value="1"/>
                                    <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_Activation_FadeOutEnd}" Value="0"/>
                                </DoubleAnimationUsingKeyFrames>
                            </local:UIStoryboard>
                        </VisualTransition.Storyboard>
                    </VisualTransition>
                </local:UIVisualStateGroup.Transitions>
            </local:UIVisualStateGroup>
        </VisualStateManager.VisualStateGroups>

        <StackPanel x:Name="ActivationLine" Orientation="Vertical" HorizontalAlignment="Center" Margin="0,12,0,0"
            Visibility="{Binding IsActivatable, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" DockPanel.Dock="Bottom">
            <Grid Height="2" Width="260">
                <local:FZMaterial Color="{StaticResource A_Color_HUDDropShadow}" Margin="2,2,-2,-2"/>
                <local:FZMaterial Color="#FFFFFFFF"/>
            </Grid>
            <Decorator RenderTransformOrigin="0.5,0.5" Margin="0,6,0,0">
                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_HudMedium_Tight}"
                                   CapHeight="22"
                                   TextWrapping="Wrap"
                                   HorizontalAlignment="Center"
                                   TextAlignment="Center"
                                   local:TextBlockInlineMarkup.Markup="{local:Loc Expansions.IDS_HUD_BrickChallengeCompleted_Prompt}"
                                   local:TextBlockInlineMarkup.ResourceBaseName="A_Style_Markup_BrickChallengeCompleted_"/>
            </Decorator>
        </StackPanel>

        <StackPanel x:Name="BottomLine" Style="{StaticResource A_Style_FrameworkElement_HorizontalSlideMotionBlurContainer}" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,11,0,0" Visibility="{Binding Subtext, Converter={StaticResource A_StringVisConverter}}" DockPanel.Dock="Bottom">
            <Decorator RenderTransformOrigin="0.5,0.5">
                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_HudLarge_Tight}"
                                   TextWrapping="Wrap"
                                   TextAlignment="Center"
                                   Text="{Binding Subtext}"
                                   CapHeight="44"/>
            </Decorator>
        </StackPanel>

        <Grid x:Name="TopLine"
            Style="{StaticResource A_Style_FrameworkElement_HorizontalSlideMotionBlurContainer}"
            Width="700"
            Height="50"
            DockPanel.Dock="Top">
            <local:FZMaterial ImageSource="{StaticResource A_BitmapImage_Gradient}"
                Stretch="Fill"
                StretchDirection="Both"/>
            <Decorator Margin="90,10">
                <local:FZTextBlock x:Name="TopLineText"
                    Style="{StaticResource A_Style_FZTextBlock_HudLarge_Tight}"
                    local:TextBlockInlineMarkup.Markup="{Binding Maintext}"
                    local:TextBlockInlineMarkup.ResourceBaseName="A_Style_Markup_BrickChallengeCompleted_" 
                    Color="{StaticResource A_Color_HUD_Text_Dark}"
                    CapHeight="32"
                    Effect="{x:Null}" 
                    TextWrapping="NoWrap" 
                    TextAlignment="Left" 
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    local:BindingProxy.A="{StaticResource A_Boolean_False}"/>
            </Decorator>
        </Grid>
    </DockPanel>
</UserControl>
