<Page x:Class="ForzaUI.A_NotificationLayer"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:local="clr-namespace:ForzaUI;assembly="
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      mc:Ignorable="d"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={x:Static RelativeSource.Self}}">
    <Page.Resources>

        <!--  sign language video dimensions -->
        <System:Double x:Key="A_Double_SignLanguageVideoSize_Small" >400</System:Double>
        <System:Double x:Key="A_Double_SignLanguageVideoSize_Medium">500</System:Double>
        <System:Double x:Key="A_Double_SignLanguageVideoSize_Large" >600</System:Double>

        <MappingConverter x:Key="A_MappingConverter_SignLanguageVideoSize" Default="{StaticResource A_Double_SignLanguageVideoSize_Medium}" CheckEnumKey="SignLanguageVideoSize">
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoSize.Small}"  Value="{StaticResource A_Double_SignLanguageVideoSize_Small}" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoSize.Medium}" Value="{StaticResource A_Double_SignLanguageVideoSize_Medium}" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoSize.Large}"  Value="{StaticResource A_Double_SignLanguageVideoSize_Large}" />
        </MappingConverter>

        <!--  sign language background dimensions -->
        <System:Double x:Key="A_Double_SignLanguageVideoBackground_Width_Small" >428</System:Double>
        <System:Double x:Key="A_Double_SignLanguageVideoBackground_Width_Medium">528</System:Double>
        <System:Double x:Key="A_Double_SignLanguageVideoBackground_Width_Large" >628</System:Double>

        <System:Double x:Key="A_Double_SignLanguageVideoBackground_Height_Small" >430</System:Double>
        <System:Double x:Key="A_Double_SignLanguageVideoBackground_Height_Medium">530</System:Double>
        <System:Double x:Key="A_Double_SignLanguageVideoBackground_Height_Large" >630</System:Double>
        
        <MappingConverter x:Key="A_MappingConverter_SignLanguageBackground_Width" Default="{StaticResource A_Double_SignLanguageVideoBackground_Width_Medium}" CheckEnumKey="SignLanguageVideoSize">
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoSize.Small}"  Value="{StaticResource A_Double_SignLanguageVideoBackground_Width_Small}" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoSize.Medium}" Value="{StaticResource A_Double_SignLanguageVideoBackground_Width_Medium}" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoSize.Large}"  Value="{StaticResource A_Double_SignLanguageVideoBackground_Width_Large}" />
        </MappingConverter>

        <MappingConverter x:Key="A_MappingConverter_SignLanguageBackground_Height" Default="{StaticResource A_Double_SignLanguageVideoBackground_Height_Medium}" CheckEnumKey="SignLanguageVideoSize">
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoSize.Small}"  Value="{StaticResource A_Double_SignLanguageVideoBackground_Height_Small}"/>
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoSize.Medium}" Value="{StaticResource A_Double_SignLanguageVideoBackground_Height_Medium}"/>
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoSize.Large}"  Value="{StaticResource A_Double_SignLanguageVideoBackground_Height_Large}"/>
        </MappingConverter>

        <!--  sign language background colours -->
        <Color x:Key="A_Color_SignLanguageBackground_Transparent">#00000000</Color>
        <Color x:Key="A_Color_SignLanguageBackground_Grey">#FF6C6C6C</Color>
        <Color x:Key="A_Color_SignLanguageBackground_Blue">#FF0075A8</Color>
        <Color x:Key="A_Color_SignLanguageBackground_GreyBlue">#FF414C5C</Color>
        <Color x:Key="A_Color_SignLanguageBackground_Black">#FF000000</Color>

        <!--  sign language textures -->
        <System:String x:Key="A_String_SignLanguageBackgroundTexture">/ForzaUI;component/Textures/Anthem/SignLanguage/background.png</System:String>
        <System:String x:Key="A_String_SignLanguageNoBackgroundAnchorTexture">/ForzaUI;component/Textures/Anthem/SignLanguage/anchor_line.png</System:String>

        <!--  sign language background converters -->
        <MappingConverter x:Key="A_MappingConverter_SignLanguageVideoBackgroundColorToColor" Default="{StaticResource A_Color_SignLanguageBackground_Transparent}" CheckEnumKey="SignLanguageBackgroundColor">
            <MappingConverterEntry Key="{x:Static local:SignLanguageBackgroundColor.Transparent}" Value="{StaticResource A_Color_SignLanguageBackground_Transparent}" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageBackgroundColor.Grey}" Value="{StaticResource A_Color_SignLanguageBackground_Grey}" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageBackgroundColor.Blue}" Value="{StaticResource A_Color_SignLanguageBackground_Blue}" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageBackgroundColor.GreyBlue}" Value="{StaticResource A_Color_SignLanguageBackground_GreyBlue}" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageBackgroundColor.Black}" Value="{StaticResource A_Color_SignLanguageBackground_Black}" />
        </MappingConverter>

        <MappingConverter x:Key="A_MappingConverter_SignLanguageIsBackgroundActive" Default="True" >
            <MappingConverterEntry Key="{x:Static local:SignLanguageBackgroundColor.Transparent}" Value="False" />
        </MappingConverter>

        <!--  sign language position on screen converters -->
        <MappingConverter x:Key="A_MappingConverter_SignLanguageVideoPositionOnScreen_HorizontalAlignment" Default="Right" CheckEnumKey="SignLanguageVideoPositionOnScreen">
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.BottomLeft}" Value="Left" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.CenterLeft}" Value="Left" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.CenterRight}" Value="Right" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.BottomRight}" Value="Right" />
        </MappingConverter>

        <MappingConverter x:Key="A_MappingConverter_SignLanguageVideoPositionOnScreen_VerticalAlignment" Default="Bottom" CheckEnumKey="SignLanguageVideoPositionOnScreen">
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.BottomLeft}" Value="Bottom" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.CenterLeft}" Value="Center" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.CenterRight}" Value="Center" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.BottomRight}" Value="Bottom" />
        </MappingConverter>
        
        <MappingConverter x:Key="A_MappingConverter_SignLanguageVideoPositionToBackgroundOrientation" Default="1.0" CheckEnumKey="SignLanguageVideoPositionOnScreen">
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.BottomLeft}" Value="-1.0" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.CenterLeft}" Value="-1.0" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.CenterRight}" Value="1.0" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.BottomRight}" Value="1.0" />
        </MappingConverter>

        <MappingConverter x:Key="A_MappingConverter_SignLanguageVideoAndNoBackgroundAnchor_Margin" Default="0,0,0,15" CheckEnumKey="SignLanguageVideoPositionOnScreen">
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.BottomLeft}" Value="0" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.CenterLeft}" Value="0,0,0,15" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.CenterRight}" Value="0,0,0,15" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.BottomRight}" Value="0" />
        </MappingConverter>

        <MappingConverter x:Key="A_MappingConverter_SignLanguageElement_Margin" Default="0,0,0,0" CheckEnumKey="SignLanguageVideoPositionOnScreen">
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.BottomLeft}" Value="0,0,0,-10" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.CenterLeft}" Value="0" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.CenterRight}" Value="0" />
            <MappingConverterEntry Key="{x:Static local:SignLanguageVideoPositionOnScreen.BottomRight}" Value="0,0,0,-10" />
        </MappingConverter>

        <Style TargetType="local:FZMediaElement"
               x:Key="A_Style_FZMediaElement_SignLanguageVideo">
            <Setter Property="IsMuted" Value="True"/>
            <Setter Property="HorizontalAlignment" Value="Right"/>
            <Setter Property="VerticalAlignment" Value="Bottom"/>
            <Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
            <Setter Property="Width" Value="{Binding Video.VideoSize, Converter={StaticResource A_MappingConverter_SignLanguageVideoSize}}"/>
            <Setter Property="Height" Value="{Binding Video.VideoSize, Converter={StaticResource A_MappingConverter_SignLanguageVideoSize}}"/>
        </Style>

        <KeyTime x:Key="A_KeyTime_SignLanguageElement_FadeInDuration">0:0:1.0</KeyTime>
        <KeyTime x:Key="A_KeyTime_SignLanguageElement_FadeOutDuration">0:0:1.0</KeyTime>
        <KeyTime x:Key="A_KeyTime_SignLanguageElement_AfterFadeOut">0:0:1.1</KeyTime>

        <Storyboard x:Key="A_Storyboard_SignLanguageElement_Show">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="{x:Null}">
                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_SignLanguageElement_FadeInDuration}" Value="1" EasingFunction="{local:QuarticEasing EasingMode=EaseOut}"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>

        <Storyboard x:Key="A_Storyboard_SignLanguageElement_Hide">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="{x:Null}">
                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_SignLanguageElement_FadeOutDuration}" Value="0" EasingFunction="{local:QuarticEasing EasingMode=EaseOut}"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
        
        <Style x:Key="A_Style_FZMaterial_SignLanguageElement" TargetType="local:FZMaterial">
            <Setter Property="HorizontalAlignment" Value="{Binding Video.PositionOnScreen, Converter={StaticResource A_MappingConverter_SignLanguageVideoPositionOnScreen_HorizontalAlignment}}" />
            <Setter Property="VerticalAlignment" Value="{Binding Video.PositionOnScreen, Converter={StaticResource A_MappingConverter_SignLanguageVideoPositionOnScreen_VerticalAlignment}}" />
            <Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
            <Setter Property="Opacity" Value="0"/>
            <Setter Property="Color" Value="#00FFFFFF" />
            <Setter Property="Margin" Value="{Binding Video.PositionOnScreen, Converter={StaticResource A_MappingConverter_SignLanguageElement_Margin}}"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding Video.IsPlaying}" Value="True" >
                    <DataTrigger.EnterActions>
                            <BeginStoryboard Storyboard="{StaticResource A_Storyboard_SignLanguageElement_Show}"/>
                    </DataTrigger.EnterActions>
                    <DataTrigger.ExitActions>
                            <BeginStoryboard Storyboard="{StaticResource A_Storyboard_SignLanguageElement_Hide}"/>
                    </DataTrigger.ExitActions>
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Storyboard x:Key="A_Storyboard_SignLanguageVideoBackground_Hide">
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="ImageSourceNoPreload">
                <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_SignLanguageElement_AfterFadeOut}" Value="{x:Null}" />
            </ObjectAnimationUsingKeyFrames>
        </Storyboard>

        <Storyboard x:Key="A_Storyboard_SignLanguageVideoBackground_Show">
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="ImageSourceNoPreload">
                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource A_String_SignLanguageBackgroundTexture}" />
            </ObjectAnimationUsingKeyFrames>
        </Storyboard>

        <Style x:Key="A_Style_FZMaterial_SignLanguageBackground" TargetType="local:FZMaterial">
            <Setter Property="HorizontalAlignment" Value="{Binding Video.PositionOnScreen, Converter={StaticResource A_MappingConverter_SignLanguageVideoPositionOnScreen_HorizontalAlignment}}"/>
            <Setter Property="VerticalAlignment" Value="{Binding Video.PositionOnScreen, Converter={StaticResource A_MappingConverter_SignLanguageVideoPositionOnScreen_VerticalAlignment}}"/>
            <Setter Property="Width" Value="{Binding Video.VideoSize, Converter={StaticResource A_MappingConverter_SignLanguageBackground_Width}}"/>
            <Setter Property="Height" Value="{Binding Video.VideoSize, Converter={StaticResource A_MappingConverter_SignLanguageBackground_Height}}"/>
            <Setter Property="Preset" Value="{StaticResource H_Roundtangle_TopLeftOnly_8px}"/>
            <Setter Property="Color" Value="{Binding Video.BackgroundColor, Converter={StaticResource A_MappingConverter_SignLanguageVideoBackgroundColorToColor}}"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding Video.BackgroundColor, Converter={StaticResource A_MappingConverter_SignLanguageIsBackgroundActive}}" Value="True" >
                    <Setter Property="Visibility" Value="{Binding Downloaded, RelativeSource={RelativeSource Self}, Converter={FZBooleanToVisibilityConverter}}"/>
                    <DataTrigger.EnterActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_SignLanguageVideoBackground_Show}"/>
                    </DataTrigger.EnterActions>
                    <DataTrigger.ExitActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_SignLanguageVideoBackground_Hide}"/>
                    </DataTrigger.ExitActions>
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_StackPanel_SignLanguageVideoAndNoBackgroundAnchor" TargetType="StackPanel">
            <Setter Property="Orientation" Value="Vertical"/>
            <Setter Property="HorizontalAlignment" Value="Right"/>
            <Setter Property="VerticalAlignment" Value="Bottom"/>
            <Setter Property="Margin" Value="{Binding Video.PositionOnScreen, Converter={StaticResource A_MappingConverter_SignLanguageVideoAndNoBackgroundAnchor_Margin}}"/>
        </Style>

        <Storyboard x:Key="A_Storyboard_SignLanguageNoBackgroundAnchor_Hide">
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="ImageSourceNoPreload">
                <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_SignLanguageElement_AfterFadeOut}" Value="{x:Null}" />
            </ObjectAnimationUsingKeyFrames>
        </Storyboard>

        <Storyboard x:Key="A_Storyboard_SignLanguageNoBackgroundAnchor_Show">
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="ImageSourceNoPreload">
                <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{StaticResource A_String_SignLanguageNoBackgroundAnchorTexture}" />
            </ObjectAnimationUsingKeyFrames>
        </Storyboard>

        <Style x:Key="A_Style_FZMaterial_SignLanguageNoBackgroundAnchor" TargetType="local:FZMaterial">
            <Setter Property="Color" Value="#FFAAAAAA"/>
            <Setter Property="Opacity" Value="0"/>
            <Setter Property="HorizontalAlignment" Value="Right"/>
            <Setter Property="VerticalAlignment" Value="Bottom"/>
            <Setter Property="Width" Value="{Binding Video.VideoSize, Converter={StaticResource A_MappingConverter_SignLanguageVideoSize}}"/>
            <Setter Property="Height" Value="2"/>
            <Style.Triggers>
                <!--  if video is in the center of the screen and background is set to transparent, show the anchor-->
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding Video.PositionOnScreen, Converter={StaticResource A_MappingConverter_SignLanguageVideoPositionOnScreen_VerticalAlignment}}" Value="Center" />
                        <Condition Binding="{Binding Video.BackgroundColor, Converter={StaticResource A_MappingConverter_SignLanguageIsBackgroundActive}}" Value="False"/>
                    </MultiDataTrigger.Conditions>
                    <Setter Property="Opacity" Value="0.6"/>
                    <Setter Property="Visibility" Value="{Binding Downloaded, RelativeSource={RelativeSource Self}, Converter={FZBooleanToVisibilityConverter}}"/>
                    <MultiDataTrigger.EnterActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_SignLanguageNoBackgroundAnchor_Show}"/>
                    </MultiDataTrigger.EnterActions>
                    <MultiDataTrigger.ExitActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_SignLanguageNoBackgroundAnchor_Hide}"/>
                    </MultiDataTrigger.ExitActions>
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>

        <Style TargetType="local:FZRun"
               x:Key="A_Style_FZRun_Subtitle_BOLD">
            <Setter Property="FontFamily"
                    Value="Horizon_C" />
        </Style>

        <Style TargetType="local:FZRun"
               x:Key="A_Style_FZRun_Dialog_Text_BOLD">
            <Setter Property="FontFamily"
                    Value="Horizon_C" />
        </Style>

        <MappingConverter x:Key="A_MappingConverter_DialogText">
            <MappingConverterEntry Key="{NoCase BOLD}" Value="{StaticResource A_Style_FZRun_Dialog_Text_BOLD}" />
        </MappingConverter>

        <Style x:Key="A_Style_Text_Subtitles"
               TargetType="{x:Type local:FZTextBlock}"
               BasedOn="{StaticResource A_Style_FZTextBlock_Body}">
            <Setter Property="Color"
                    Value="#F5F5F5" />
            <Setter Property="FontSize"
                    Value="28" />
            <Setter Property="Effect"
                    Value="{StaticResource A_DropShadowEffect_DefaultHud}" />
            <Setter Property="TextAlignment"
                    Value="Center" />
        </Style>

      <Style x:Key="A_Style_Text_Captions"
           TargetType="{x:Type local:FZTextBlock}"
           BasedOn="{StaticResource A_Style_FZTextBlock_Body}">
        <Setter Property="Color"
                Value="{StaticResource H_Color_Primary_Yellow}" />
        <Setter Property="FontSize"
                Value="28" />
        <Setter Property="Effect"
                Value="{StaticResource A_DropShadowEffect_DefaultHud}" />
        <Setter Property="TextAlignment"
                Value="Center" />
      </Style>
      
        <Style x:Key="A_Style_Text_Dialogue_Base"
               TargetType="{x:Type local:FZTextBlock}"
               BasedOn="{StaticResource A_Style_FZTextBlock_HorizonD}">
            <Setter Property="Color"
                    Value="#FFFFFF" />
            <Setter Property="Effect"
                    Value="{StaticResource A_Effect_HighContrastModeDropShadow}" />
            <Setter Property="TextAlignment"
                    Value="Left" />
            <Setter Property="TextWrapping"
                    Value="Wrap" />
        </Style>

        <Style x:Key="A_Style_Text_Dialogue"
               TargetType="{x:Type local:FZTextBlock}"
               BasedOn="{StaticResource A_Style_Text_Dialogue_Base}">
            <Setter Property="LineStackingStrategy"
                    Value="BlockLineHeight" />
        </Style>
        
        <local:MappingConverter x:Key="A_MappingConverter_FZMaterial_Color_FromCharacterId" Default="#FFFFFF">
            <local:MappingConverterEntry Key="1" Value="{StaticResource A_Color_VO_Anna}" />
            <local:MappingConverterEntry Key="2" Value="{StaticResource A_Color_VO_Narrator}" />
            <local:MappingConverterEntry Key="3" Value="{StaticResource A_Color_VO_Announcer}" /> 
            <local:MappingConverterEntry Key="4" Value="{StaticResource A_Color_VO_Announcer}" />
            <local:MappingConverterEntry Key="5" Value="{StaticResource A_Color_VO_Mei}" />
            <local:MappingConverterEntry Key="6" Value="{StaticResource A_Color_VO_Helena}" />
            <local:MappingConverterEntry Key="7" Value="{StaticResource A_Color_VO_Jordan}" />
            <local:MappingConverterEntry Key="8" Value="{StaticResource A_Color_VO_Keiko}" />
            <local:MappingConverterEntry Key="9" Value="{StaticResource A_Color_VO_Yuji}" />
            <local:MappingConverterEntry Key="10" Value="{StaticResource A_Color_VO_Midori}" />
            <local:MappingConverterEntry Key="11" Value="{StaticResource A_Color_VO_Isamu}" />
            <local:MappingConverterEntry Key="12" Value="{StaticResource A_Color_VO_Robert}" />
            <local:MappingConverterEntry Key="13" Value="{StaticResource A_Color_VO_Nico}" />
            <local:MappingConverterEntry Key="14" Value="{StaticResource A_Color_VO_PulseDJ}" />
            <local:MappingConverterEntry Key="15" Value="{StaticResource A_Color_VO_BassArenaDJ}" />
            <local:MappingConverterEntry Key="16" Value="{StaticResource A_Color_VO_BlockPartyDJ}" />
            <local:MappingConverterEntry Key="17" Value="{StaticResource A_Color_VO_XSDJ}" />
            <local:MappingConverterEntry Key="18" Value="{StaticResource A_Color_VO_HospitalDJ}" />
            <local:MappingConverterEntry Key="19" Value="{StaticResource A_Color_VO_GachaCityDJ}" />
            <local:MappingConverterEntry Key="20" Value="{StaticResource A_Color_VO_SubPopDJ}" />
            <local:MappingConverterEntry Key="21" Value="{StaticResource A_Color_VO_WaveDJ}" />
            <local:MappingConverterEntry Key="22" Value="{StaticResource A_Color_VO_OpusDJ}" />
            <local:MappingConverterEntry Key="23" Value="{StaticResource A_Color_VO_StreamerDJ}" />
            <local:MappingConverterEntry Key="24" Value="{StaticResource A_Color_VO_Announcer_Chopper}" />
            <local:MappingConverterEntry Key="25" Value="{StaticResource A_Color_VO_Announcer_Rocket}" /> 
            <local:MappingConverterEntry Key="26" Value="{StaticResource A_Color_VO_Bystander}" />
            <local:MappingConverterEntry Key="27" Value="{StaticResource A_Color_VO_Bystander}" />
            <local:MappingConverterEntry Key="28" Value="{StaticResource A_Color_VO_Bystander}" />
            <local:MappingConverterEntry Key="29" Value="{StaticResource A_Color_VO_Bystander}" />
            <local:MappingConverterEntry Key="30" Value="{StaticResource A_Color_VO_BroadcastDirector}" />
            <local:MappingConverterEntry Key="31" Value="{StaticResource A_Color_VO_HorizonMinuteHost}" />
            <local:MappingConverterEntry Key="32" Value="{StaticResource A_Color_VO_BroadcastPresenter}" />
            <local:MappingConverterEntry Key="33" Value="{StaticResource A_Color_VO_HorizonTech}" />
            <local:MappingConverterEntry Key="34" Value="{StaticResource A_Color_VO_Commentator}" />
            <local:MappingConverterEntry Key="35" Value="{StaticResource A_Color_VO_Commentator}" />
            <local:MappingConverterEntry Key="36" Value="{StaticResource A_Color_VO_Customer}" />
            <local:MappingConverterEntry Key="37" Value="{StaticResource A_Color_VO_Customer}" /> 
            <local:MappingConverterEntry Key="38" Value="{StaticResource A_Color_VO_Customer}" /> 
            <local:MappingConverterEntry Key="39" Value="{StaticResource A_Color_VO_Customer}" /> 
            <local:MappingConverterEntry Key="40" Value="{StaticResource A_Color_VO_Customer}" /> 
            <local:MappingConverterEntry Key="41" Value="{StaticResource A_Color_VO_Customer}" /> 
            <local:MappingConverterEntry Key="42" Value="{StaticResource A_Color_VO_Customer}" /> 
            <local:MappingConverterEntry Key="43" Value="{StaticResource A_Color_VO_Customer}" /> 
            <local:MappingConverterEntry Key="44" Value="{StaticResource A_Color_VO_ScottTyler}" /> 
            <local:MappingConverterEntry Key="45" Value="{StaticResource A_Color_VO_AmySimpson}" /> 
            <local:MappingConverterEntry Key="46" Value="{StaticResource A_Color_VO_Isabel}" /> 
            <local:MappingConverterEntry Key="47" Value="{StaticResource A_Color_VO_Darius}" /> 
            <local:MappingConverterEntry Key="48" Value="{StaticResource A_Color_VO_Warren}" /> 
            <local:MappingConverterEntry Key="49" Value="{StaticResource A_Color_VO_Ashley}" /> 
            <local:MappingConverterEntry Key="50" Value="{StaticResource A_Color_VO_Keira}" /> 
            <local:MappingConverterEntry Key="51" Value="{StaticResource A_Color_VO_Hayley}" />
            <local:MappingConverterEntry Key="52" Value="{StaticResource A_Color_VO_Announcer_Train}" />
            <local:MappingConverterEntry Key="53" Value="{StaticResource A_Color_VO_Announcer_Touge}" /> 
            <local:MappingConverterEntry Key="54" Value="{StaticResource A_Color_VO_LarryChen}" /> 
            <local:MappingConverterEntry Key="55" Value="{StaticResource A_Color_VO_FoodJobHelper}" /> 
            <local:MappingConverterEntry Key="56" Value="{StaticResource A_Color_VO_Pilot}" /> 
            <local:MappingConverterEntry Key="57" Value="{StaticResource A_Color_VO_Pilot}" /> 
            <local:MappingConverterEntry Key="58" Value="{StaticResource A_Color_VO_ChaserZero}" />
            <local:MappingConverterEntry Key="59" Value="{StaticResource A_Color_VO_RestaurantOwner}" />
        </local:MappingConverter>


        <ControlTemplate x:Key="A_ControlTemplate_VOIcon"
                         TargetType="{x:Type Control}">
            <ControlTemplate.Resources>
                <BitmapImage x:Key="A_BitmapImage_RadioIcon" UriSource="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Radio_VO_Icon.png" />

                <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPreset_Circle_CharacterIconBg" CornerRadius="38"/>

                <local:MappingConverter x:Key="A_MappingConverter_FZMaterial_Icon_FromCharacterId" Default="{x:Null}">
                    <local:MappingConverterEntry Key="5" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Mei.png" />
                    <local:MappingConverterEntry Key="6" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Helena.png" />
                    <local:MappingConverterEntry Key="7" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Jordan.png" />
                    <local:MappingConverterEntry Key="8" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Keiko.png" />
                    <local:MappingConverterEntry Key="9" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Yuji.png" />
                    <local:MappingConverterEntry Key="10" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Midori.png" />
                    <local:MappingConverterEntry Key="11" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Isamu.png" />
                    <local:MappingConverterEntry Key="12" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Robert.png" />
                    <local:MappingConverterEntry Key="13" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Nico.png" />
                    <local:MappingConverterEntry Key="44" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Scott.png" />
                    <local:MappingConverterEntry Key="45" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Amy.png" />
                    <local:MappingConverterEntry Key="46" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Isabel.png" />
                    <local:MappingConverterEntry Key="47" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Darius.png" />
                    <local:MappingConverterEntry Key="48" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Warren.png" />
                    <local:MappingConverterEntry Key="49" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Ashley.png" />
                    <local:MappingConverterEntry Key="50" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Keira.png" />
                    <local:MappingConverterEntry Key="51" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/Hayley.png" />
                    <local:MappingConverterEntry Key="54" Value="/ForzaUI;component/Textures/Data_Bound/HUD/Voiceover_Icons/LarryChen.png" />
                </local:MappingConverter>
            </ControlTemplate.Resources>
            <local:FZMaterial x:Name="CharacterTextures" Preset="{StaticResource A_FZMaterialPreset_Circle_CharacterIconBg}" Color="{StaticResource A_Color_ButtonBar_Background}"
                                Margin="-38,0,0,-12" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="76" Height="76">
                <Grid>
                    <local:FZMaterial x:Name="SpeakerIcon" HorizontalAlignment="Center" VerticalAlignment="Center" Width="68" Height="68"
                                    ImageSource="{StaticResource A_BitmapImage_RadioIcon}" Visibility="Hidden"/>
                    <local:FZMaterial x:Name="CharacterIcon" HorizontalAlignment="Center" VerticalAlignment="Center" Width="68" Height="68"
                                    ImageSource="{Binding CharacterId, RelativeSource={RelativeSource AncestorType=local:DialogueControl}, Converter={StaticResource A_MappingConverter_FZMaterial_Icon_FromCharacterId}}"/>
                </Grid>
            </local:FZMaterial>
            <ControlTemplate.Triggers>
                <DataTrigger Binding="{Binding ImageSource, ElementName=CharacterIcon}" Value="{x:Null}">
                    <Setter TargetName="CharacterIcon" Property="Visibility" Value="Hidden"/>
                    <Setter TargetName="SpeakerIcon" Property="Visibility" Value="Visible"/>
                </DataTrigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>

        <ControlTemplate x:Key="A_ControlTemplate_DialogueControl"
                         TargetType="{x:Type local:DialogueControl}">
            <ControlTemplate.Resources>
                <local:MappingConverter x:Key="A_MappingConverter_FZMaterialGlassCapture_SubtitlePositionToVisibility" Default="Visible">
                    <local:MappingConverterEntry Key="{x:Static local:DialogueSubtitlePosition.HudAnalogSpeedometer}" Value="Collapsed" />
                    <local:MappingConverterEntry Key="{x:Static local:DialogueSubtitlePosition.HudDigitalSpeedometer}" Value="Collapsed" />
                    <local:MappingConverterEntry Key="{x:Static local:DialogueSubtitlePosition.HudNoSpeedometer}" Value="Collapsed" />
                </local:MappingConverter>

                <Storyboard x:Key="A_Storyboard_Show">
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                                   Storyboard.TargetName="control_root">
                        <EasingDoubleKeyFrame KeyTime="0:0:0.0"
                                              Value="0" />
                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                              Value="1" />
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"
                                                   Storyboard.TargetName="text_container">
                        <EasingDoubleKeyFrame KeyTime="0:0:0"
                                              Value="80" />
                        <EasingDoubleKeyFrame KeyTime="0:0:0.3"
                                              Value="0">
                            <EasingDoubleKeyFrame.EasingFunction>
                                <QuarticEase EasingMode="EaseOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
                <Storyboard x:Key="A_Storyboard_Hide">
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
                                                   Storyboard.TargetName="control_root">
                        <EasingDoubleKeyFrame KeyTime="0:0:1.0"
                                              Value="1" />
                        <EasingDoubleKeyFrame KeyTime="0:0:1.3"
                                              Value="0" />
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
                <local:UIStoryboard x:Key="A_Storyboard_BlendValueInputChanged">
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetName="{x:Null}"
                                                   FillBehavior="Stop"
                                                   Storyboard.TargetProperty="(local:BlendValue.Blend)">
                        <DiscreteDoubleKeyFrame KeyTime="0:0:0"
                                                Value="0" />
                        <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                              Value="1">
                            <EasingDoubleKeyFrame.EasingFunction>
                                <QuarticEase EasingMode="EaseOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                    </DoubleAnimationUsingKeyFrames>
                </local:UIStoryboard>

                <Storyboard x:Key="A_Storyboard_PleaseWait_HudAnalogSpeedometer">
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"
                                                   Storyboard.TargetName="PleaseWaitControl">
                        <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                              Value="0" >
                            <EasingDoubleKeyFrame.EasingFunction>
                                <QuarticEase EasingMode="EaseOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)"
                                                   Storyboard.TargetName="PleaseWaitControl">
                        <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                              Value="-305" >
                            <EasingDoubleKeyFrame.EasingFunction>
                                <QuarticEase EasingMode="EaseOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
                <Storyboard x:Key="A_Storyboard_PleaseWait_HudDigitalSpeedometer">
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"
                                                   Storyboard.TargetName="PleaseWaitControl">
                        <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                              Value="0" >
                            <EasingDoubleKeyFrame.EasingFunction>
                                <QuarticEase EasingMode="EaseOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)"
                                                   Storyboard.TargetName="PleaseWaitControl">
                        <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                              Value="-152" >
                            <EasingDoubleKeyFrame.EasingFunction>
                                <QuarticEase EasingMode="EaseOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
                <Storyboard x:Key="A_Storyboard_PleaseWait_HudNoSpeedometer">
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"
                                                   Storyboard.TargetName="PleaseWaitControl">
                        <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                              Value="0" >
                            <EasingDoubleKeyFrame.EasingFunction>
                                <QuarticEase EasingMode="EaseOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)"
                                                   Storyboard.TargetName="PleaseWaitControl">
                        <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                              Value="-40">
                            <EasingDoubleKeyFrame.EasingFunction>
                                <QuarticEase EasingMode="EaseOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
                <Storyboard x:Key="A_Storyboard_PleaseWait_Normal">
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"
                                                   Storyboard.TargetName="PleaseWaitControl">
                        <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                              Value="0" >
                            <EasingDoubleKeyFrame.EasingFunction>
                                <QuarticEase EasingMode="EaseOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)"
                                                   Storyboard.TargetName="PleaseWaitControl">
                        <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                              Value="0" >
                            <EasingDoubleKeyFrame.EasingFunction>
                                <QuarticEase EasingMode="EaseOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>

                <!-- These converter values all work together to centre the text visually, tweak them together -->
                <local:LinearTransformConverter x:Key="A_Converter_SubtitleContainerSizeMultiLine" Scale="3.7" />
                <local:LinearTransformConverter x:Key="A_Converter_SubtitleContainerSizeSingleLine" Scale="1.6" />
                <local:LinearTransformConverter x:Key="A_Converter_SubtitleTopSpacing" Scale="0.3" />

                <Style x:Key="A_Style_FrameworkElement_SubtitlesContainerSizer"
                       TargetType="FrameworkElement">
                    <Setter Property="Height" Value="0" />
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding SubtitlesLineCount, RelativeSource={RelativeSource AncestorType={x:Type local:DialogueControl}}, Converter={StaticResource A_CompareConverter}, ConverterParameter=1}"
                                     Value="{x:Static local:CompareResult.Equal}">
                            <Setter Property="Height"
                                    Value="{Binding SubtitlesFontCapHeight, RelativeSource={RelativeSource AncestorType=local:DialogueControl}, Converter={StaticResource A_Converter_SubtitleContainerSizeSingleLine}}" />
                        </DataTrigger>
                        <DataTrigger Binding="{Binding SubtitlesLineCount, RelativeSource={RelativeSource AncestorType={x:Type local:DialogueControl}}, Converter={StaticResource A_CompareConverter}, ConverterParameter=1}"
                                     Value="{x:Static local:CompareResult.GreaterThan}">
                            <Setter Property="Height"
                                    Value="{Binding SubtitlesFontCapHeight, RelativeSource={RelativeSource AncestorType=local:DialogueControl}, Converter={StaticResource A_Converter_SubtitleContainerSizeMultiLine}}" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>

                <Style x:Key="A_Style_FrameworkElement_DialogueSubtitleRoot"
                       TargetType="FrameworkElement">
                    <Setter Property="local:BindingProxy.TunnelOut"
                            Value="{Binding A, Source={StaticResource A_GlobalStorageValue_SubtitlesHeight}, Mode=OneWayToSource}" />
                    <Setter Property="local:BindingProxy.TunnelIn"
                            Value="0" />
                    <Setter Property="MaxWidth"
                            Value="900" />
                    <Setter Property="Tag"
                            Value="{Binding SubtitlesFontCapHeight, RelativeSource={RelativeSource AncestorType=local:DialogueControl}, Converter={StaticResource A_Converter_SubtitlesFontSizeValue}}" />
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Opacity, ElementName=control_root, Converter={StaticResource A_CompareConverter}, ConverterParameter=0}"
                                     Value="{x:Static local:CompareResult.GreaterThan}">
                            <Setter Property="local:BindingProxy.TunnelIn"
                                    Value="{Binding ActualHeight, RelativeSource={RelativeSource Self}}" />
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource A_CompareConverter}, ConverterParameter=6}"
                                     Value="{x:Static local:CompareResult.GreaterThan}">
                            <Setter Property="MaxWidth"
                                    Value="1180" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>

                <CornerRadius x:Key="H_CornerRadius_PleaseWait_Left">17,0,0,17</CornerRadius>
                <FZMaterialPresetRoundtangle x:Key="H_Roundtangle_PleaseWait_Left" CornerRadius="{StaticResource H_CornerRadius_PleaseWait_Left}" />

            </ControlTemplate.Resources>
            <Grid x:Name="control_root"
                  Opacity="0">
                <DockPanel VerticalAlignment="Bottom"
                           HorizontalAlignment="Center"
                           Style="{StaticResource A_Style_FrameworkElement_DialogueSubtitleRoot}">
                    <Grid DockPanel.Dock="Top">
                        <local:FZMaterial Color="#000000"
                                          Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll3px}"
                                          Opacity="{Binding SubtitlesBackgroundOpacity, RelativeSource={RelativeSource AncestorType=local:DialogueControl}}"
                                          Margin="-14,-5"
                                          Visibility="{Binding SubtitlesEnabled, RelativeSource={RelativeSource AncestorType=local:DialogueControl}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
                        <Grid>
                            <DockPanel Visibility="{Binding SubtitlesEnabled, RelativeSource={RelativeSource AncestorType=local:DialogueControl}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                                <StackPanel DockPanel.Dock="Left">
                                    <Decorator Height="{Binding SubtitlesFontCapHeight, RelativeSource={RelativeSource AncestorType=DialogueControl}, Converter={StaticResource A_Converter_SubtitleTopSpacing}}" />
                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_HorizonC}"
                                                       local:MultiStringFormatter.Format="{local:Loc InGame.IDS_Subtitles_SpeakerCharacterName}"
                                                       local:MultiStringFormatter.Param0="{Binding CharacterDisplayName, RelativeSource={RelativeSource AncestorType=local:DialogueControl}}"
                                                       Text="{Binding (local:MultiStringFormatter.Output), RelativeSource={RelativeSource Self}}"
                                                       Color="{Binding CharacterId, RelativeSource={RelativeSource AncestorType=local:DialogueControl}, Converter={StaticResource A_MappingConverter_FZMaterial_Color_FromCharacterId}}"
                                                       CapHeight="{Binding SubtitlesFontCapHeight, RelativeSource={RelativeSource AncestorType=local:DialogueControl}}" 
                                                       Effect="{StaticResource A_Effect_HighContrastModeDropShadow}"/>
                                </StackPanel>
                                <Decorator DockPanel.Dock="Left"
                                           Width="10" />
                                <Grid x:Name="text_container"
                                           ClipToBounds="True"
                                           VerticalAlignment="Center"
                                           DockPanel.Dock="Right"
                                           Style="{StaticResource A_Style_FrameworkElement_SubtitlesContainerSizer}">
                                    <Grid.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform />
                                            <SkewTransform />
                                            <RotateTransform />
                                            <TranslateTransform />
                                        </TransformGroup>
                                    </Grid.RenderTransform>

                                    <StackPanel>
                                        <Decorator Height="{Binding SubtitlesFontCapHeight, RelativeSource={RelativeSource AncestorType=DialogueControl}, Converter={StaticResource A_Converter_SubtitleTopSpacing}}" />
                                        <Decorator>
                                            <local:FZTextBlock x:Name="text_element"
                                                               Style="{StaticResource A_Style_Text_Dialogue}"
                                                               Text="{Binding Text, RelativeSource={RelativeSource AncestorType=local:DialogueControl}}"
                                                               MarkupConverter="{StaticResource A_MappingConverter_DialogText}"
                                                               VerticalAlignment="Top"
                                                               Stretch="None"
                                                               CapHeight="{Binding SubtitlesFontCapHeight, RelativeSource={RelativeSource AncestorType=local:DialogueControl}}"
                                                               local:BlendValue.InputChangedStoryboard="{StaticResource A_Storyboard_BlendValueInputChanged}"
                                                               local:BlendValue.Input="{Binding TextOffset, RelativeSource={RelativeSource AncestorType=local:DialogueControl}}"
                                                               local:DialogueControl.TextHeight="{Binding ActualHeight, RelativeSource={RelativeSource Self}}"
                                                               LineHeight="{Binding SubtitlesLineHeight, RelativeSource={RelativeSource AncestorType=local:DialogueControl}}" />
                                            <Decorator.RenderTransform>
                                                <TranslateTransform Y="{Binding Path=(local:BlendValue.Output), ElementName=text_element}" />
                                            </Decorator.RenderTransform>
                                        </Decorator>
                                    </StackPanel>

                                </Grid>
                            </DockPanel>
                        </Grid>
                    </Grid>
                    <Decorator x:Name="BottomSpacing"
                               Height="70" />
                </DockPanel>
                <Grid Visibility="{Binding Blocking, RelativeSource={RelativeSource AncestorType=local:DialogueControl}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                      x:Name="PleaseWaitControl">
                    <Grid.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform />
                            <SkewTransform />
                            <RotateTransform />
                            <TranslateTransform />
                        </TransformGroup>
                    </Grid.RenderTransform>
                    <Viewbox Height="34"
                             Stretch="Uniform"
                             HorizontalAlignment="Right"
                             VerticalAlignment="Bottom"
                             Margin="0,0,50,70">
                        <Grid>
                            <local:FZMaterialGlassCapture x:Name="GlassCapture" Visibility="{Binding DialoguePosition, Converter={StaticResource A_MappingConverter_FZMaterialGlassCapture_SubtitlePositionToVisibility}}"/> 
                            <local:FZMaterial x:Name="FullPillBacking" Height="34" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Preset="{StaticResource H_Roundtangle_LeftOnly_1px}" Color="{StaticResource A_Color_ButtonBar_Background}">
                                <StackPanel Orientation="Horizontal">
                                    <Control Template="{StaticResource A_ControlTemplate_VOIcon}" />
                                    <Decorator Visibility="Visible" RenderTransformOrigin="0.5,0.5" RenderTransform="{StaticResource A_SkewTransform_HUD_Italics}"
                                                Margin="10,0,27,0">
                                        <local:FZTextBlock Text="{Binding CharacterDisplayName, RelativeSource={RelativeSource AncestorType=local:DialogueControl}}"
                                                Color="{Binding CharacterId, RelativeSource={RelativeSource AncestorType=local:DialogueControl}, Converter={StaticResource A_MappingConverter_FZMaterial_Color_FromCharacterId}}"
                                                FontFamily="Horizon_A"
                                                HorizontalAlignment="Center" 
                                                VerticalAlignment="Center" 
                                                Margin="0,0,0,0"
                                                CapHeight="18" 
                                                Effect="{StaticResource A_DropShadowEffect_DefaultHud}" />
                                    </Decorator>
                                    <local:FZMaterial x:Name="PleaseWaitTextBacking" Preset="{StaticResource H_Roundtangle_PleaseWait_Left}"  Color="{StaticResource A_Color_ButtonBar_Background}" Height="34" Margin="-17,0,0,0">
                                        <Decorator Visibility="Visible" RenderTransformOrigin="0.5,0.5" RenderTransform="{StaticResource A_SkewTransform_HUD_Italics}"
                                                Margin="10,8,10,8">
                                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_HorizonA}"
                                                               Color="#FFFFFF"
                                                               Text="{local:Loc Main.IDS_BlockingVO_Please_Wait_Title}"
                                                               TextAlignment="Center"
                                                               VerticalAlignment="Center"
                                                               Stretch="None"
                                                               CapHeight="16"
                                                               Effect="{StaticResource A_DropShadowEffect_DefaultHud}" />
                                        </Decorator>
                                    </local:FZMaterial>
                                </StackPanel>
                            </local:FZMaterial>
                        </Grid>
                    </Viewbox>
                </Grid>
            </Grid>
            <ControlTemplate.Triggers>
                <DataTrigger Binding="{Binding Show, RelativeSource={RelativeSource Self}}"
                             Value="True">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_Show}" />
                    </DataTrigger.EnterActions>
                    <DataTrigger.ExitActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_Hide}" />
                    </DataTrigger.ExitActions>
                </DataTrigger>
                <DataTrigger Binding="{Binding DialoguePosition}" Value="{x:Static local:DialogueSubtitlePosition.HudAnalogSpeedometer}">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_PleaseWait_HudAnalogSpeedometer}" />
                    </DataTrigger.EnterActions>
                </DataTrigger>
                <DataTrigger Binding="{Binding DialoguePosition}" Value="{x:Static local:DialogueSubtitlePosition.HudDigitalSpeedometer}">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_PleaseWait_HudDigitalSpeedometer}" />
                    </DataTrigger.EnterActions>
                </DataTrigger>
                <DataTrigger Binding="{Binding DialoguePosition}" Value="{x:Static local:DialogueSubtitlePosition.HudNoSpeedometer}">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_PleaseWait_HudNoSpeedometer}" />
                    </DataTrigger.EnterActions>
                </DataTrigger>
                <DataTrigger Binding="{Binding DialoguePosition}" Value="{x:Static local:DialogueSubtitlePosition.Normal}">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_PleaseWait_Normal}" />
                    </DataTrigger.EnterActions>
                </DataTrigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>


        <Style x:Key="A_Style_FZTextBlock_WatermarkGamertag"
               TargetType="{x:Type local:FZTextBlock}"
               BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}">
            <Setter Property="Text"
                    Value="{Binding WatermarkGamertag}" />
            <Setter Property="Color"
                    Value="#FFFFFF" />
            <Setter Property="CapHeight"
                    Value="120" />
            <Setter Property="Margin"
                    Value="-100,0,-100,0" />
            <Setter Property="VerticalAlignment"
                    Value="Center" />
            <Setter Property="HorizontalAlignment"
                    Value="Center" />
            <Setter Property="TextAlignment"
                    Value="Center" />
        </Style>

        <Style x:Key="A_Style_FrameworkElement_GamertagContainer"
               TargetType="FrameworkElement">
            <Setter Property="LayoutTransform">
                <Setter.Value>
                    <TransformGroup>
                        <ScaleTransform ScaleX="{Binding Path=AutoScaleValue, Source={StaticResource PART_UIResolutionScaler}}"
                                        ScaleY="{Binding Path=AutoScaleValue, Source={StaticResource PART_UIResolutionScaler}}" />
                        <RotateTransform Angle="-30" />
                    </TransformGroup>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="A_Style_FZTextBlock_WatermarkBuildInfo"
               TargetType="{x:Type local:FZTextBlock}"
               BasedOn="{StaticResource A_Style_FZTextBlock_HorizonC}">
            <Setter Property="Text"
                    Value="{Binding WatermarkBuildInfo}" />
            <Setter Property="Color"
                    Value="#FFFFFF" />
            <Setter Property="CapHeight"
                    Value="40" />
            <Setter Property="VerticalAlignment"
                    Value="Bottom" />
            <Setter Property="HorizontalAlignment"
                    Value="Right" />
            <Setter Property="Margin"
                    Value="50,20,50,50" />
            <Setter Property="LayoutTransform">
                <Setter.Value>
                    <ScaleTransform ScaleX="{Binding Path=AutoScaleValue, Source={StaticResource PART_UIResolutionScaler}}"
                                    ScaleY="{Binding Path=AutoScaleValue, Source={StaticResource PART_UIResolutionScaler}}" />
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="A_Style_FrameworkElement_NotificationPopupControl" TargetType="{x:Type FrameworkElement}">
            <Setter Property="local:BindingProxy.TunnelOut" Value="{Binding A, Source={StaticResource A_GlobalStorageValue_NotificationPopupHeight}, Mode=OneWayToSource}" />
            <Setter Property="local:BindingProxy.TunnelIn" Value="0" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding Visibility, RelativeSource={RelativeSource Self}}" Value="{x:Static Visibility.Visible}">
                    <Setter Property="local:BindingProxy.TunnelIn" Value="{Binding ActualHeight, RelativeSource={RelativeSource Self}}" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_FZTextBlock_BuildInfo"
               TargetType="{x:Type local:FZTextBlock}"
               BasedOn="{StaticResource A_Style_FZTextBlock_HorizonC}">
            <Setter Property="Text"
                    Value="{Binding BuildInfo}" />
            <Setter Property="Color"
                    Value="#FFFFFF" />
            <Setter Property="CapHeight"
                    Value="16" />
            <Setter Property="VerticalAlignment"
                    Value="Bottom" />
            <Setter Property="HorizontalAlignment"
                    Value="Left" />
            <Setter Property="Margin"
                    Value="12,12" />
            <Setter Property="LayoutTransform">
                <Setter.Value>
                    <ScaleTransform ScaleX="{Binding Path=AutoScaleValue, Source={StaticResource PART_UIResolutionScaler}}"
                                    ScaleY="{Binding Path=AutoScaleValue, Source={StaticResource PART_UIResolutionScaler}}" />
                </Setter.Value>
            </Setter>
        </Style>

    </Page.Resources>
    <Grid Visibility="{Binding IsEnabled, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
        <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}"
              HorizontalAlignment="Stretch"
              VerticalAlignment="Stretch"
              Height="Auto"
              Width="Auto">
            <local:NotificationPopupControl HUDData.Type="HUDStatusNotificationPopup"
                                            HorizontalAlignment="Center"
                                            VerticalAlignment="Top"
                                             Margin="0,43,0,0"
                                             Style="{StaticResource A_Style_FrameworkElement_NotificationPopupControl}" />
            <local:HUD321Control HUDData.Type="HUDStatus321"
                                 Margin="0,300,0,0"
                                 VerticalAlignment="Top"
                                 HorizontalAlignment="Center" />
            <StackPanel Margin="0,0,0,128"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Bottom">
                <local:HUDRaceFinishCountdownControl HUDData.Type="HUDStatusRaceCountdown" />
                <Decorator Height="64"
                           Visibility="{Binding IsE3, Source={StaticResource PART_UISceneContext}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"/>
            </StackPanel>
            <local:FZMaterial x:Name="SignLanguageElement"
                              Style="{StaticResource A_Style_FZMaterial_SignLanguageElement}">
                <local:FZMaterial.RenderTransform>
                    <ScaleTransform ScaleX="{Binding Video.PositionOnScreen, Converter={StaticResource A_MappingConverter_SignLanguageVideoPositionToBackgroundOrientation}}"/>
                </local:FZMaterial.RenderTransform>
                <Grid HorizontalAlignment="{Binding Video.PositionOnScreen, Converter={StaticResource A_MappingConverter_SignLanguageVideoPositionOnScreen_HorizontalAlignment}}"
                      VerticalAlignment="{Binding Video.PositionOnScreen, Converter={StaticResource A_MappingConverter_SignLanguageVideoPositionOnScreen_VerticalAlignment}}">
                    <local:FZMaterial x:Name="Background"
                                      Style="{StaticResource A_Style_FZMaterial_SignLanguageBackground}"/>
                    <StackPanel x:Name="VideoAndNoBackgroundAnchor"
                                Style="{StaticResource A_Style_StackPanel_SignLanguageVideoAndNoBackgroundAnchor}">
                        <local:FZMediaElement x:Name="PART_SignLanguage_Video"
                                              Source="{Binding Video.VideoPath}"
                                              local:FzMediaElementExtension.Loop="False"
                                              LoadedBehavior="Play"
                                              UnloadedBehavior="Close"
                                              Style="{StaticResource A_Style_FZMediaElement_SignLanguageVideo}">
                            <local:FZMediaElement.RenderTransform>
                                <ScaleTransform ScaleX="{Binding Video.PositionOnScreen, Converter={StaticResource A_MappingConverter_SignLanguageVideoPositionToBackgroundOrientation}}"/>
                            </local:FZMediaElement.RenderTransform>
                            <local:FZMediaElement.Preset>
                                <local:FZMaterialPresetRoundtangle AlphaMode="MultSrcAlpha" />
                            </local:FZMediaElement.Preset>
                        </local:FZMediaElement>
                        <local:FZMaterial x:Name="NoBackgroundAnchor"
                                          Style="{StaticResource A_Style_FZMaterial_SignLanguageNoBackgroundAnchor}"/>
                    </StackPanel>
                </Grid>
            </local:FZMaterial>

            <Decorator>
              <StackPanel VerticalAlignment="Bottom">
                <local:StackPanel.Resources>
                        <Storyboard x:Key="Move_Normal">
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)">
                                <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                                      Value="0" >
                                    <EasingDoubleKeyFrame.EasingFunction>
                                        <QuarticEase EasingMode="EaseOut" />
                                    </EasingDoubleKeyFrame.EasingFunction>
                                </EasingDoubleKeyFrame>
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
                                <EasingDoubleKeyFrame KeyTime="0:0:0.6"
                                                      Value="0" >
                                    <EasingDoubleKeyFrame.EasingFunction>
                                        <QuarticEase EasingMode="EaseOut" />
                                    </EasingDoubleKeyFrame.EasingFunction>
                                </EasingDoubleKeyFrame>
                            </DoubleAnimationUsingKeyFrames>
                        </Storyboard>
                    </local:StackPanel.Resources>
                <local:StackPanel.Style>
                  <Style TargetType="{x:Type local:StackPanel}">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding DialoguePosition}" Value="{x:Static local:DialogueSubtitlePosition.Normal}">
                                    <DataTrigger.EnterActions>
                                        <BeginStoryboard Storyboard="{StaticResource Move_Normal}" />
                                    </DataTrigger.EnterActions>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                </local:StackPanel.Style>
                <local:StackPanel.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform />
                            <SkewTransform />
                            <RotateTransform />
                            <TranslateTransform />
                        </TransformGroup>
                  </local:StackPanel.RenderTransform>
                <Grid Margin="0,0,0,50">
                  <local:FZMaterial Visibility="{Binding Subtitles.AudioCaption, Converter={StaticResource A_StringVisConverter}}"
                                    Width="{Binding ElementName=Captions, Path=ActualWidth, Converter={LinearTransformConverter Add=20}}" 
                                    Height="{Binding ElementName=Captions, Path=ActualHeight, Converter={LinearTransformConverter Add=20}}" 
                                    Color="#000000"
                                    Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll3px}"
                                    Opacity="{Binding SubtitlesBackgroundOpacity, ElementName=DialogueControl}"
                                    Margin="0,00,00,-10">
                  </local:FZMaterial>
                  <local:FZTextBlock x:Name="Captions"
                                     Style="{StaticResource A_Style_Text_Captions}"
                                     HorizontalAlignment="Center"
                                     Margin="0"
                                     TextWrapping="Wrap"
                                     VerticalAlignment="Bottom"
                                     Text="{Binding Subtitles.AudioCaption}"
                                     CapHeight="{Binding SubtitlesFontCapHeight, ElementName=DialogueControl}">
                  </local:FZTextBlock>
                </Grid>
                <local:DialogueControl x:Name="DialogueControl"
                                       Template="{StaticResource A_ControlTemplate_DialogueControl}"
                                       TextLineHeight="{Binding SubtitlesLineHeight, RelativeSource={RelativeSource Self}}">
                </local:DialogueControl>
              </StackPanel>
            </Decorator> 

            <HUDFullscreenTitleControl HUDData.Type="HUDStatusFullscreenTitle"/>

            <local:FZTextBlock x:Name="Subtitles"
                               Style="{StaticResource A_Style_Text_Subtitles}"
                               Width="1000"
                               HorizontalAlignment="Center"
                               Margin="0,0,0,50"
                               TextWrapping="Wrap"
                               VerticalAlignment="Bottom"
                               Text="{Binding Subtitles.Subtitle}" />

            <local:FZTextBlock 
                Visibility="{Binding VideoStats.Visible, Converter={StaticResource A_FZBooleanToVisibilityConverter}, FallbackValue=Collapsed}"
                Text="{Binding VideoStats.FPS}" 
                Style="{StaticResource A_Style_Text_Dialogue}"
                Margin="5"
                VerticalAlignment="Top" 
                HorizontalAlignment="Right"
                FontFamily="Horizon_D_tf" />
        </Grid>
        <DockPanel x:Name="FlightingWatermark" Opacity="0.2" Visibility="{Binding ShowWatermark, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkBuildInfo}" DockPanel.Dock="Bottom" />
        
            <UniformGrid Rows="3" Columns="5">
                <Decorator Style="{StaticResource A_Style_FrameworkElement_GamertagContainer}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkGamertag}" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_GamertagContainer}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkGamertag}" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_GamertagContainer}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkGamertag}" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_GamertagContainer}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkGamertag}" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_GamertagContainer}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkGamertag}" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_GamertagContainer}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkGamertag}" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_GamertagContainer}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkGamertag}" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_GamertagContainer}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkGamertag}" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_GamertagContainer}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkGamertag}" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_GamertagContainer}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkGamertag}" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_GamertagContainer}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkGamertag}" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_GamertagContainer}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkGamertag}" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_GamertagContainer}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkGamertag}" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_GamertagContainer}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkGamertag}" />
                </Decorator>
                <Decorator Style="{StaticResource A_Style_FrameworkElement_GamertagContainer}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_WatermarkGamertag}" />
                </Decorator>
            </UniformGrid>
        </DockPanel>
        <local:FZTextBlock Visibility="{Binding ShowBuildInfo, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                      Style="{StaticResource A_Style_FZTextBlock_BuildInfo}" DockPanel.Dock="Bottom" Opacity="0.8"/>
    </Grid>
</Page>
