<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.NotificationPopupControl">

    <UserControl.Resources>

        <System:Double x:Key="A_Double_NotificationPopup_Height">90</System:Double>
        <System:Double x:Key="A_Double_NotificationPopup_MinWidth">345</System:Double>

        <local:FZMaterialPresetGlassRoundtangle x:Key="A_FZMaterialPresetGlassRoundtangle_Notification_RoundAll"
            BlurAmount="Medium"
            CornerRadius="7,7,7,7"/>
        <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_Notification_RoundLeft"
            CornerRadius="7,2,2,7"/>

        <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_Countdown_Round"
        BasedOn="{StaticResource A_FZMaterialPreset_FlatPanel_Base}"
        CornerRadius="12.5"/>

        <Style x:Key="A_Style_ProgressBar_NotificationSpinner" TargetType="ProgressBar" BasedOn="{StaticResource A_Style_ProgressBar_WaitSpinnerDark}">
            <Style.Resources>
                <System:Double x:Key="A_Double_LoadingSpinner_DotRadius_Dynamic">0.35</System:Double>
                <System:Double x:Key="A_Double_LoadingSpinner_OrbitRadius_Dynamic">0.65</System:Double>
            </Style.Resources>
            <Style.Setters>
                <Setter Property="Width" Value="21" />
                <Setter Property="Height" Value="21" />
                <Setter Property="Margin" Value="0,1,6,0"/>
                <Setter Property="HorizontalAlignment" Value="Left" />
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="IsIndeterminate" Value="True"/>
            </Style.Setters>
        </Style>

        <Storyboard x:Key="A_Storyboard_Notification_Show_FzEvents" />
        <Storyboard x:Key="A_Storyboard_Notification_Hide_FzEvents" >
            <StringAnimationUsingKeyFrames Storyboard.TargetProperty="(local:EventFire.EventName)" 
                                           Storyboard.TargetName="{x:Null}"
                                           FillBehavior="Stop">
                <DiscreteStringKeyFrame KeyTime="0:0:0.0" Value=""/>
                <DiscreteStringKeyFrame KeyTime="0:0:0.2" Value="HiddenComplete"/>
                <DiscreteStringKeyFrame KeyTime="0:0:0.3" Value=""/>
            </StringAnimationUsingKeyFrames>
        </Storyboard>

        <Style x:Key="A_Style_FrameworkElement_Notification" TargetType="{x:Type FrameworkElement}">
            <Setter Property="Height" Value="{StaticResource A_Double_NotificationPopup_Height}"/>
            <Setter Property="MinWidth" Value="{StaticResource A_Double_NotificationPopup_MinWidth}"/>
            <Setter Property="Opacity" Value="0"/>
            <Setter Property="local:BindingProxy.A" Value="{StaticResource A_Boolean_False}"/>
            <Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
            <Setter Property="RenderTransform">
                <Setter.Value>
                    <TranslateTransform />
                </Setter.Value>
            </Setter>
            <Setter Property="local:ZPanel.Transform">
                <Setter.Value>
                    <Transform3DGroup>
                        <RotateTransform3D CenterY="47.5">
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Axis="-1,0,0" Angle="0"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                        <TranslateTransform3D OffsetZ="0"/>
                    </Transform3DGroup>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <DataTrigger Binding="{Binding Show, FallbackValue={StaticResource A_Boolean_False}}" Value="{StaticResource A_Boolean_True}">
                    <Setter Property="local:BindingProxy.A" Value="{StaticResource A_Boolean_True}" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_EventFire_Notification" TargetType="{x:Type local:EventFire}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Show}" Value="True">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_Notification_Show_FzEvents}" />
                    </DataTrigger.EnterActions>
                    <DataTrigger.ExitActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_Notification_Hide_FzEvents}" />
                    </DataTrigger.ExitActions>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        
        <Style x:Key="A_Style_FZTextBlock_Notification_Base" TargetType="{x:Type local:FZTextBlock}">
            <Setter Property="FontFamily" Value="Horizon_A"/>
            <Setter Property="FontSize" Value="20" />
            <Setter Property="LineAdjust" Value="{StaticResource A_Double_LineAdjust_HorizonA}"/>
            <Setter Property="Color" Value="{StaticResource A_Color_HUD_Text}" />
            <Setter Property="TextWrapping" Value="Wrap"/>
        </Style>

        <Style x:Key="A_Style_FZTextBlock_Notification_Title" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_Notification_Base}">
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="TextAlignment" Value="Center"/>
            <Setter Property="Color" Value="{StaticResource A_Color_Notification_BodyText}"/>
        </Style>

        <Style x:Key="A_Style_FZTextBlock_Notification_Text" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_Notification_Base}">
            <Setter Property="FontFamily" Value="Horizon_A"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="TextAlignment" Value="Center"/>
            <Setter Property="Color" Value="{StaticResource A_Color_Notification_BodyText}"/>
        </Style>

        <Style x:Key="A_Style_FZTextBlock_Notification_Gamertag" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_Notification_Title}">
            <Setter Property="Color" Value="{StaticResource A_Color_NotificationPopup_Highlight}"/>
            <Setter Property="FontSize" Value="28"/>
            <Setter Property="FontFamily" Value="Horizon_A"/>
        </Style>

        <Style x:Key="A_Style_FZTextBlock_Notification_ActivateDescriptionText" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_Notification_Text}">
            <Setter Property="local:MultiStringFormatter.Format" Value=""/>
            <Setter Property="local:ScreenReader.LineType" Value="NotificationPrompt"/>
            <Setter Property="local:ScreenReader.Event" Value="OnChange"/>
            <Style.Triggers>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding CanBeActivated}" Value="{StaticResource A_Boolean_True}"/>
                        <Condition Binding="{Binding PlayerHasAccepted}" Value="{StaticResource A_Boolean_False}"/>
                        <Condition Binding="{Binding IsInputBlocked}" Value="{StaticResource A_Boolean_False}"/>
                        <Condition Binding="{Binding (local:BindingProxy.A), ElementName=LayoutRoot}" Value="{StaticResource A_Boolean_True}"/>
                        <Condition Binding="{Binding (local:MultiStringFormatter.Output), ElementName=TitleText, Converter={StaticResource A_StringVisConverter}, FallbackValue={x:Static Visibility.Collapsed}}" Value="{x:Static Visibility.Visible}"/>
                    </MultiDataTrigger.Conditions>
                    <Setter Property="local:MultiStringFormatter.Format" Value="{local:Loc Main.IDS_ScreenReader_Format_NotificationPrompt_WithButton}"/>
                    <Setter Property="local:ScreenReader.Line" Value="{Binding (local:MultiStringFormatter.Output), RelativeSource={RelativeSource Self}}"/>
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_FZTextBlock_Notification_InputBlockedText" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_Notification_Text}">
            <Setter Property="local:ScreenReader.LineType" Value="NotificationPrompt"/>
            <Setter Property="local:ScreenReader.Event" Value="OnChange"/>
            <Style.Triggers>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding CanBeActivated}" Value="{StaticResource A_Boolean_True}"/>
                        <Condition Binding="{Binding PlayerHasAccepted}" Value="{StaticResource A_Boolean_False}"/>
                        <Condition Binding="{Binding IsInputBlocked}" Value="{StaticResource A_Boolean_True}"/>
                        <Condition Binding="{Binding (local:BindingProxy.A), ElementName=LayoutRoot}" Value="{StaticResource A_Boolean_True}"/>
                        <Condition Binding="{Binding (local:MultiStringFormatter.Output), ElementName=TitleText, Converter={StaticResource A_StringVisConverter}, FallbackValue={x:Static Visibility.Collapsed}}" Value="{x:Static Visibility.Visible}"/>
                    </MultiDataTrigger.Conditions>
                    <Setter Property="local:ScreenReader.Line" Value="{Binding InputBlockedText}"/>
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_FZTextBlock_Notification_AcceptedText" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_Notification_Text}">
            <Setter Property="local:ScreenReader.LineType" Value="NotificationPrompt"/>
            <Setter Property="local:ScreenReader.Event" Value="OnChange"/>
            <Style.Triggers>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding CanBeActivated}" Value="{StaticResource A_Boolean_True}"/>
                        <Condition Binding="{Binding PlayerHasAccepted}" Value="{StaticResource A_Boolean_True}"/>
                        <Condition Binding="{Binding (local:BindingProxy.A), ElementName=LayoutRoot}" Value="{StaticResource A_Boolean_True}"/>
                        <Condition Binding="{Binding (local:MultiStringFormatter.Output), ElementName=TitleText, Converter={StaticResource A_StringVisConverter}, FallbackValue={x:Static Visibility.Collapsed}}" Value="{x:Static Visibility.Visible}"/>
                    </MultiDataTrigger.Conditions>
                    <Setter Property="local:ScreenReader.Line" Value="{Binding AcceptedText}"/>
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_FZTextBlock_Invite_Countdown" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_Notification_Base}">
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="FontFamily" Value="Horizon_A"/>
            <Setter Property="FontSize" Value="20"/>
            <Setter Property="Color" Value="{StaticResource A_Color_NotificationBadge_Text}"/>
        </Style>

        <local:MappingConverter x:Key="A_MappingConverter_FZMaterial_Icon_SeasonEnumToNotificationIcon" Default="{x:Null}">
            <local:MappingConverterEntry Key="{x:Static local:Season.Spring}" Value="/ForzaUI;component/Textures/Anthem/Icons/NotificationPopup/Spring.png" />
            <local:MappingConverterEntry Key="{x:Static local:Season.Summer}" Value="/ForzaUI;component/Textures/Anthem/Icons/NotificationPopup/Summer.png" />
            <local:MappingConverterEntry Key="{x:Static local:Season.Autumn}" Value="/ForzaUI;component/Textures/Anthem/Icons/NotificationPopup/Autumn.png" />
            <local:MappingConverterEntry Key="{x:Static local:Season.Winter}" Value="/ForzaUI;component/Textures/Anthem/Icons/NotificationPopup/Winter.png" />
        </local:MappingConverter>

        <Style x:Key="A_Style_FZMaterial_Notification_Icon" TargetType="{x:Type local:FZMaterial}">
            <Setter Property="Width" Value="{StaticResource A_Double_NotificationPopup_Height}" />
            <Setter Property="Height" Value="{StaticResource A_Double_NotificationPopup_Height}" />
            <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Icons/NotificationPopup/Party_Invite.png" />
            <Setter Property="Visibility" Value="Visible"/>
            <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_Notification_RoundLeft}" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding Tag, RelativeSource={RelativeSource Self}}" Value="{x:Static Visibility.Visible}">
                    <Setter Property="Visibility" Value="Collapsed" />
                </DataTrigger>
                <DataTrigger Binding="{Binding IsInfectedEvent}" Value="True">
                    <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Icons/NotificationPopup/Infected_Invite.png" />
                </DataTrigger>
                <DataTrigger Binding="{Binding IsKingEvent}" Value="True">
                    <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Icons/NotificationPopup/King_Invite.png" />
                </DataTrigger>
                <DataTrigger Binding="{Binding IsRaceEvent}" Value="True">
                    <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Icons/NotificationPopup/Race_Invite.png" />
                </DataTrigger>
                <DataTrigger Binding="{Binding IsNetworkIssue}" Value="True">
                    <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Icons/NotificationPopup/Notification_Alert.png" />
                </DataTrigger>
                <DataTrigger Binding="{Binding IsBucketListEvent}" Value="True">
                    <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Icons/NotificationPopup/Bucket_List_Invite.png" />
                </DataTrigger>
                <DataTrigger Binding="{Binding IsDeepLink}" Value="True">
                    <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Icons/NotificationPopup/Deep_Link.png" />
                </DataTrigger>
                <DataTrigger Binding="{Binding IsDrivatar}" Value="True">
                    <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Icons/NotificationPopup/Drivatar.png" />
                </DataTrigger>
                <DataTrigger Binding="{Binding IsConvoy}" Value="True">
                    <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Icons/NotificationPopup/Convoy.png" />
                </DataTrigger>
                <DataTrigger Binding="{Binding IsStuntParty}" Value="True">
                    <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Icons/NotificationPopup/Forzathon_Live.png" />
                    <Setter Property="Preset" Value="{StaticResource A_FZMaterialPreset_FlatPanel_Base}"/>
                    <Setter Property="Width" Value="116"/>
                    <Setter Property="Height" Value="116"/>
                    <Setter Property="Margin" Value="-13"/>
                </DataTrigger>
                <DataTrigger Binding="{Binding IsSeasonal}" Value="True">
                    <Setter Property="ImageSource" Value="{Binding Season, Converter={StaticResource A_MappingConverter_FZMaterial_Icon_SeasonEnumToNotificationIcon}}" />
                </DataTrigger>
                <!-- #TODO_PostGreenlight Remove this trigger -->
                <DataTrigger Binding="{Binding ShowGreenlightUserIcon}" Value="True">
                    <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Icons/NotificationPopup/GreenlightUser.png" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_FZMaterial_Notification_GamerPic" TargetType="{x:Type local:FZMaterial}">
            <Setter Property="Width" Value="{StaticResource A_Double_NotificationPopup_Height}" />
            <Setter Property="Height" Value="{StaticResource A_Double_NotificationPopup_Height}" />
            <Setter Property="ImageSource" Value="{Binding UserProfile, Converter={StaticResource A_GamerPicConverter}, ConverterParameter={StaticResource A_Size_GamerPicSizeParams}}" />
            <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_Notification_RoundLeft}" />
            <Setter Property="Visibility" Value="{Binding Downloaded, RelativeSource={RelativeSource Self}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding UserProfile}" Value="{x:Null}">
                    <Setter Property="Visibility" Value="Collapsed"/>
                </DataTrigger>
                <!-- #TODO_PostGreenlight Remove this trigger -->
                <DataTrigger Binding="{Binding ShowGreenlightUserIcon}" Value="True">
                    <Setter Property="Visibility" Value="Collapsed"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <local:StringSubstitutionConverter x:Key="A_Converter_NotificationMarkupSubstitution">
            <local:StringSubstitution Find="[TM]" Replace="{local:Loc InGame.IDS_Trademark}"/>
            <local:StringSubstitution Find="[FORZATHON]" Replace="{local:Loc InGame.IDS_ForzathonLive}"/>
            <local:StringSubstitution Find="[GAMERTAG]" Replace="{StaticResource A_String_0FormatString}"/>
            <local:StringSubstitution Find="[GAMERTAG_SMALL]" Replace="{StaticResource A_String_0FormatString}"/>
            <local:StringSubstitution Find="[GAMERTAG_INLINE]" Replace="{StaticResource A_String_0FormatString}"/>
        </local:StringSubstitutionConverter>

        <Style x:Key="A_Style_NotificationMarkup_TEXT"
               TargetType="local:FZRun">
        </Style>

        <Style x:Key="A_Style_NotificationMarkup_LARGE"
               TargetType="local:FZRun">
            <Setter Property="FontSize" Value="24"/>
        </Style>

        <Style x:Key="A_Style_NotificationMarkup_HIGHLIGHT_LARGE"
               TargetType="local:FZRun">
            <Setter Property="Color" Value="{StaticResource A_Color_Notification_HighlightText}"/>
            <Setter Property="FontSize" Value="28"/>
            <Setter Property="FontFamily" Value="Horizon_A"/>
        </Style>

        <Style x:Key="A_Style_NotificationMarkup_HIGHLIGHT"
               TargetType="local:FZRun">
            <Setter Property="Color" Value="{StaticResource A_Color_Notification_HighlightText}"/>
            <Setter Property="FontSize" Value="24"/>
            <Setter Property="FontFamily" Value="Horizon_A"/>
        </Style>

        <Style x:Key="A_Style_NotificationMarkup_HIGHLIGHT_SMALL"
               TargetType="local:FZRun">
            <Setter Property="Color" Value="{StaticResource A_Color_Notification_HighlightText}"/>
        </Style>

        <Style x:Key="A_Style_NotificationMarkup_BOLD"
               TargetType="local:FZRun">
            <Setter Property="FontSize" Value="24"/>
            <Setter Property="FontFamily" Value="Horizon_A"/>
        </Style>

        <Style x:Key="A_Style_NotificationMarkup_TM" TargetType="{x:Type Control}">
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <local:FZTextBlock Text="{local:Loc InGame.IDS_Trademark}"
                                           TextAlignment="Center"
                                           FontFamily="Horizon_A"
                                           CapHeight="10"
                                           Margin="0,0,0,12"
                                           HorizontalAlignment="Stretch"
                                           Style="{StaticResource A_Style_FZTextBlock_Notification_Title}"
                                           TextWrapping="NoWrap"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="A_Style_NotificationMarkup_FORZATHON" TargetType="{x:Type Control}">
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Anthem/Icons/Forzathon_Live_Logo.png" Width="180" Height="22" Margin="0,0,0,3"
                                          Color="{StaticResource A_Color_ContentBackgroundImage}" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="A_Style_NotificationMarkup_FORZATHON_HIGHLIGHT_SMALL"
               TargetType="local:FZRun">
            <Setter Property="Color" Value="{StaticResource A_Color_ForzathonLive_Highlight}"/>
        </Style>

        <Style x:Key="A_Style_NotificationMarkup_GAMERTAG" TargetType="{x:Type Control}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <local:FZTextBlock x:Name="GamertagText"
                                           Text="{Binding UserProfile.FormattedGamertag}"
                                           Style="{StaticResource A_Style_FZTextBlock_Notification_Gamertag}" Margin="0,4,0,6"
                                           TextWrapping="NoWrap"
                                           local:AncestorPropertySetter.Type="{x:Type local:FZTextBlock}"
                                           local:AncestorPropertySetter.AttachedPropertyType="{x:Type local:MultiStringFormatter}"
                                           local:AncestorPropertySetter.Property="Param0"
                                           local:AncestorPropertySetter.Value="{Binding UserProfile.FormattedGamertag}"
                                           local:AncestorPropertySetter.AllowParentBindingFailure="{StaticResource A_Boolean_True}"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="A_Style_NotificationMarkup_GAMERTAG_SMALL" TargetType="{x:Type Control}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <local:FZTextBlock x:Name="GamertagText"
                                           Text="{Binding UserProfile.FormattedGamertag}"
                                           FontSize="24"
                                           Style="{StaticResource A_Style_FZTextBlock_Notification_Gamertag}" Margin="0,2,0,4"
                                           TextWrapping="NoWrap"
                                           local:AncestorPropertySetter.Type="{x:Type local:FZTextBlock}"
                                           local:AncestorPropertySetter.AttachedPropertyType="{x:Type local:MultiStringFormatter}"
                                           local:AncestorPropertySetter.Property="Param0"
                                           local:AncestorPropertySetter.Value="{Binding UserProfile.FormattedGamertag}"
                                           local:AncestorPropertySetter.AllowParentBindingFailure="{StaticResource A_Boolean_True}"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="A_Style_NotificationMarkup_GAMERTAG_INLINE" TargetType="{x:Type Control}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <local:FZTextBlock x:Name="GamertagText"
                                           Text="{Binding UserProfile.FormattedGamertag}"
                                           Style="{StaticResource A_Style_FZTextBlock_Notification_Title}" Margin="0,2,0,5"
                                           TextWrapping="NoWrap"
                                           local:AncestorPropertySetter.Type="{x:Type local:FZTextBlock}"
                                           local:AncestorPropertySetter.AttachedPropertyType="{x:Type local:MultiStringFormatter}"
                                           local:AncestorPropertySetter.Property="Param0"
                                           local:AncestorPropertySetter.Value="{Binding UserProfile.FormattedGamertag}"
                                           local:AncestorPropertySetter.AllowParentBindingFailure="{StaticResource A_Boolean_True}"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="A_Style_NotificationMarkup_CARCLASS" TargetType="{x:Type Control}" BasedOn="{StaticResource A_Style_Control_CarClassBadge_Small_Default}">
            <Setter Property="local:BindingProxy.A" Value="{Binding PerformanceIndex}"/>
            <Setter Property="local:BindingProxy.B" Value="{Binding CarClassID}"/>
            <Setter Property="Width" Value="54"/>
            <Setter Property="Height" Value="22"/>
        </Style>

        <Style x:Key="A_Style_FZTextBlock_Notification_TitleText" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_Notification_Title}">
            <Setter Property="local:MultiStringFormatter.Format" Value=""/>
            <Setter Property="local:ScreenReader.LineType" Value="NotificationTitle"/>
            <Setter Property="local:ScreenReader.Event" Value="OnChange"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding (local:BindingProxy.A), ElementName=LayoutRoot}" Value="{StaticResource A_Boolean_True}">
                    <Setter Property="local:MultiStringFormatter.Format" Value="{Binding Title, Converter={StaticResource A_Converter_NotificationMarkupSubstitution}}"/>
                    <Setter Property="local:ScreenReader.Line" Value="{Binding (local:MultiStringFormatter.Output), Converter={StaticResource A_Converter_TrimInlineMarkup}, RelativeSource={RelativeSource Self}}"/>
                </DataTrigger>
                <MultiDataTrigger>
                    <MultiDataTrigger.Conditions>
                        <Condition Binding="{Binding TitleScreenReader, Converter={StaticResource A_StringVisConverter}, FallbackValue={x:Static Visibility.Collapsed}}" Value="{x:Static Visibility.Visible}"/>
                        <Condition Binding="{Binding (local:BindingProxy.A), ElementName=LayoutRoot}" Value="{StaticResource A_Boolean_True}"/>
                    </MultiDataTrigger.Conditions>
                    <Setter Property="local:MultiStringFormatter.Format" Value="{Binding TitleScreenReader, Converter={StaticResource A_Converter_NotificationMarkupSubstitution}}"/>
                    <Setter Property="local:ScreenReader.Line" Value="{Binding (local:MultiStringFormatter.Output), Converter={StaticResource A_Converter_TrimInlineMarkup}, RelativeSource={RelativeSource Self}}"/>
                </MultiDataTrigger>
            </Style.Triggers>
        </Style>

        <KeyTime x:Key="A_KeyTime_NotificationShowAnimation">0:0:0.45</KeyTime>
        <KeyTime x:Key="A_KeyTime_NotificationHideAnimation">0:0:0.20</KeyTime>

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

        <ControlTemplate x:Key="A_ControlTemplate_NotifcationPopupControl" TargetType="ContentControl">
            <ControlTemplate.Resources>
                <Storyboard x:Key="A_Storyboard_Notification_Show">
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                    Storyboard.TargetName="LayoutRoot">
                        <DiscreteDoubleKeyFrame KeyTime="0:0:0.0" Value="0.0" />
                        <DiscreteDoubleKeyFrame KeyTime="0:0:0.25" Value="1.0" />
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(local:ZPanel.Transform).(Transform3DGroup.Children)[0].(RotateTransform3D.Rotation).(AxisAngleRotation3D.Angle)"
                        Storyboard.TargetName="LayoutRoot">
                        <DiscreteDoubleKeyFrame KeyTime="0:0:0.0" Value="80"/>
                        <DiscreteDoubleKeyFrame KeyTime="0:0:0.25" Value="80"/>
                        <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_NotificationShowAnimation}" Value="0" EasingFunction="{StaticResource A_EasingFunction_EaseIn}"/>
                    </DoubleAnimationUsingKeyFrames>
                    <StringAnimationUsingKeyFrames Storyboard.TargetProperty="(local:AudioEvent.SoundName)"
                                                    Storyboard.TargetName="ShowAudioEvent">
                        <DiscreteStringKeyFrame KeyTime="0:0:0"
                                                Value="/Master/UI/Notification/HZ3_SFX_HUD_Notification_MinorOn_01" />
                        <DiscreteStringKeyFrame KeyTime="0:0:0.333"
                                                Value="" />
                    </StringAnimationUsingKeyFrames>
                </Storyboard>

                <Storyboard x:Key="A_Storyboard_Notification_Hide">
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Opacity)"
                                                    Storyboard.TargetName="LayoutRoot">
                        <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_NotificationHideAnimation}" Value="0.0" />
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(local:ZPanel.Transform).(Transform3DGroup.Children)[0].(RotateTransform3D.Rotation).(AxisAngleRotation3D.Angle)"
                        Storyboard.TargetName="LayoutRoot">
                        <DiscreteDoubleKeyFrame KeyTime="0" Value="0"/>
                        <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_NotificationHideAnimation}" Value="-99" EasingFunction="{StaticResource A_EasingFunction_EaseIn}"/>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>

                <Style x:Key="A_Style_Decorator_Countdown_Visibility" TargetType="Decorator">
                    <Setter Property="Visibility" Value="Visible"/>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Countdown, Converter={StaticResource A_CompareConverter}, ConverterParameter=60}" Value="1">
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>

            </ControlTemplate.Resources>

            <ControlTemplate.Triggers>
                <DataTrigger Binding="{Binding Show}" Value="True">
                    <DataTrigger.EnterActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_Notification_Show}" />
                    </DataTrigger.EnterActions>
                    <DataTrigger.ExitActions>
                        <BeginStoryboard Storyboard="{StaticResource A_Storyboard_Notification_Hide}" />
                    </DataTrigger.ExitActions>
                </DataTrigger>
            </ControlTemplate.Triggers>

            <StackPanel x:Name="LayoutRoot" Orientation="Vertical" Style="{StaticResource A_Style_FrameworkElement_Notification}">
                <Grid Height="{StaticResource A_Double_NotificationPopup_Height}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="90"/> <!-- GamerPic Width -->
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <local:FZMaterial Grid.ColumnSpan="2" Color="#FFFFFFFF" Preset="{StaticResource A_FZMaterialPresetGlassRoundtangle_Notification_RoundAll}" Height="{StaticResource A_Double_NotificationPopup_Height}"/>
                    <local:FZMaterial Grid.ColumnSpan="2"
                                      Color="#FFE5E5E5" 
                                      Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterBottomOnly}" 
                                      Visibility="{Binding CanBeActivated, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" Height="34"
                                      VerticalAlignment="Bottom"/>
                    <Grid Grid.Column="0">
                        <local:FZMaterial x:Name="GamerPicMaterial"
                                    Style="{StaticResource A_Style_FZMaterial_Notification_GamerPic}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Notification_Icon}"
                                    Tag="{Binding Visibility, ElementName=GamerPicMaterial}"/>
                        <Decorator Style="{StaticResource A_Style_Decorator_Countdown_Visibility}">
                            <local:FZMaterial Color="{StaticResource A_Color_NotificationBadge_Background}"
                                    Visibility="{Binding ShowCountdown, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                                    Preset="{StaticResource A_FZMaterialPresetRoundtangle_Countdown_Round}"
                                    HorizontalAlignment="Right"
                                    VerticalAlignment="Bottom"
                                    Height="25"
                                    Width="25"
                                    Margin="6,5">
                                <local:FZTextBlock x:Name="CountdownText"
                                               Text="{Binding Countdown, Converter={StaticResource A_NumUnitConverter_NoUnit_0dp}}"
                                               Style="{StaticResource A_Style_FZTextBlock_Invite_Countdown}"
                                               Margin="0,0,0,0"/>
                            </local:FZMaterial>
                        </Decorator>
                    </Grid>
                    <DockPanel Grid.Column="1">
                        <Grid DockPanel.Dock="Bottom" 
                                  Visibility="{Binding CanBeActivated, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                                  Height="33">
                            <StackPanel Orientation="Horizontal"
                                                    VerticalAlignment="Center"
                                                    HorizontalAlignment="Center"
                                                    Margin="11,4">
                                <Grid>
                                    <Grid Visibility="{Binding PlayerHasAccepted, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}">
                                        <StackPanel Orientation="Horizontal" 
                                                            Visibility="{Binding IsInputBlocked, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}">
                                            <Viewbox Height="21"
                                                            MinWidth="21"
                                                            Margin="0,0,7,0">
                                                <local:ControllerButtonControl x:Name="ActivateButton"
                                                                Margin="0"
                                                                Style="{StaticResource A_Style_ControllerButtonControl_ActivationButton}" />
                                            </Viewbox>
                                            <local:FZTextBlock x:Name="ButtonText"
                                                               Text="{Binding ActivateDescription}"
                                                               Style="{StaticResource A_Style_FZTextBlock_Notification_ActivateDescriptionText}"
                                                               local:MultiStringFormatter.Param0="{Binding ScreenReaderName, ElementName=ActivateButton}"
                                                               local:MultiStringFormatter.Param1="{Binding ActivateDescription}"/>
                                        </StackPanel>
                                        <local:FZTextBlock x:Name="InputBlockedText"
                                                           Text="{Binding InputBlockedText}"
                                                           Style="{StaticResource A_Style_FZTextBlock_Notification_InputBlockedText}"
                                                           Visibility="{Binding IsInputBlocked, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                                                           VerticalAlignment="Center"/>
                                    </Grid>
                                    <StackPanel Orientation="Horizontal"
                                                Visibility="{Binding PlayerHasAccepted, Converter={StaticResource A_FZBooleanToVisibilityConverter}}">
                                        <ProgressBar Style="{StaticResource A_Style_ProgressBar_NotificationSpinner}"
                                                     Visibility="{Binding ShowSpinner, Converter={StaticResource A_FZBooleanToVisibilityConverter}, FallbackValue={x:Static Visibility.Hidden}}"/>
                                        <local:FZTextBlock x:Name="AcceptedText"
                                                           Text="{Binding AcceptedText}"
                                                           Style="{StaticResource A_Style_FZTextBlock_Notification_AcceptedText}"
                                                           VerticalAlignment="Center"/>
                                    </StackPanel>

                                </Grid>
                            </StackPanel>
                        </Grid>

                        <Decorator Margin="12,4" VerticalAlignment="Center" HorizontalAlignment="Center"  MaxWidth="600">
                            <local:FZTextBlock x:Name="TitleText"
                                               local:TextBlockInlineMarkup.Markup="{Binding Title}"
                                               local:TextBlockInlineMarkup.ResourceBaseName="A_Style_NotificationMarkup_"
                                               Style="{StaticResource A_Style_FZTextBlock_Notification_TitleText}"/>
                        </Decorator>
                    </DockPanel>

                    <local:EventFire x:Name="EventFire" Style="{StaticResource A_Style_EventFire_Notification}" />
                    <local:AudioEvent x:Name="ShowAudioEvent" />
                </Grid>
            </StackPanel>
        </ControlTemplate>
    </UserControl.Resources>

    <ContentControl Template="{StaticResource A_ControlTemplate_NotifcationPopupControl}" />
</UserControl>
