<ResourceDictionary
    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">

    <System:Double x:Key="A_Double_FlyerRotation_FrontFaceShowing">0</System:Double>
    <System:Double x:Key="A_Double_FlyerRotation_BackFaceShowing">180</System:Double> 

    <local:MappingConverter x:Key="A_MappingConverter_SelectedBorderColor">
        <local:MappingConverterEntry Key="{StaticResource A_Boolean_False}" Value="{StaticResource A_Color_White}"/>
        <local:MappingConverterEntry Key="{StaticResource A_Boolean_True}" Value="{StaticResource H_Color_Primary_Purple}"/>
    </local:MappingConverter>

    <local:MappingConverter x:Key="A_Converter_FlyerBackImageFromMode">
    </local:MappingConverter>

    <local:MappingConverter x:Key="A_Converter_MediaTrackToVisibility">
        <local:MappingConverterEntry Key="{x:Static local:XAMLTrack.Default}" Value="{x:Static Visibility.Collapsed}" />
        <local:MappingConverterEntry Key="{x:Static local:XAMLTrack.ExpansionOne}" Value="{x:Static Visibility.Visible}" />
        <local:MappingConverterEntry Key="{x:Static local:XAMLTrack.ExpansionTwo}" Value="{x:Static Visibility.Visible}" />
    </local:MappingConverter>

    <Style x:Key="A_Style_Flyer_Image" TargetType="local:FZMaterial" BasedOn="{StaticResource A_Style_FZMaterial_FlyerBackgroundImage}">
        <Setter Property="ImageSource" Value="{Binding FlyerImagePath}"/>
        <Setter Property="Stretch" Value="Fill"/>
    </Style>

    <System:Double x:Key="A_Double_BucketList_TileItem_Width">446</System:Double>
    <System:Double x:Key="A_Double_BucketList_TileItem_Height">710</System:Double>

    <System:Double x:Key="A_Double_BucketList_Flyer_Width">442</System:Double>
    <System:Double x:Key="A_Double_BucketList_Flyer_Height">710</System:Double>
    <System:Double x:Key="A_Double_BucketList_Flyer_FlyerHalfWidth">221</System:Double>

    <Style x:Key="A_Style_FZMaterial_FooterCustomRouteIcon_BucketList"
           TargetType="{x:Type local:FZMaterial}"
           BasedOn="{StaticResource A_Style_FZMaterial_FooterCustomRouteIcon}">
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsCustomRoute}" Value="{StaticResource A_Boolean_True}">
                <Setter Property="Visibility" Value="Visible"/>
                <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Data_Bound/Event_Blueprint/Custom_Route.png"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="A_Style_FZMaterial_FooterHasPropsIcon_BucketList"
           TargetType="{x:Type local:FZMaterial}"
           BasedOn="{StaticResource A_Style_FZMaterial_FooterHasPropsIcon}">
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsProps}" Value="{StaticResource A_Boolean_True}">
                <Setter Property="Visibility" Value="Visible"/>
                <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Data_Bound/Event_Blueprint/Custom_Props.png"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="A_Style_FZMaterial_FooterNoRewindIcon_BucketList"
           TargetType="{x:Type local:FZMaterial}"
           BasedOn="{StaticResource A_Style_FZMaterial_FooterNoRewindIcon}">
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsRewindEnabled}" Value="{StaticResource A_Boolean_False}">
                <Setter Property="Visibility" Value="Visible"/>
                <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Data_Bound/Event_Blueprint/No_Rewind.png"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <!--Footer Content-->
    <ControlTemplate x:Key="A_ControlTemplate_Races_FooterContent_BucketList" TargetType="Control">
        <StackPanel x:Name="FooterContent" Margin="25" VerticalAlignment="Bottom" Orientation="Horizontal">
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_FooterSeasonIcon}"/>
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_FooterCustomRouteIcon_BucketList}"/>
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_FooterHasPropsIcon_BucketList}"/>
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_FooterNoRewindIcon_BucketList}"/>
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_FooterPlayedIcon}"/>
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_FooterFavoriteIcon}"/>
        </StackPanel>
    </ControlTemplate>
    
       
    <Style x:Key="A_Style_FZTextBlock_Flyer_ChallengeTypeName"
           TargetType="local:FZTextBlock"
           BasedOn="{StaticResource A_Style_TextBlock_CampaignSetupFlyer_Heading_Base}">
        <Setter Property="CapHeight" Value="21" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="HorizontalAlignment" Value="Stretch" />
        <Setter Property="TextAlignment" Value="Center" />
        <Setter Property="MaxWidth" Value="308" />
        <Setter Property="FontFamily" Value="Horizon_C" />
        <Setter Property="Text" Value="{Binding ChallengeTypeName}" />
        <Setter Property="TextWrapping" Value="NoWrap" />
    </Style>

    <Style x:Key="A_Style_Control_BucketListFlyer_Front" TargetType="Control">
        <Style.Resources>
            <Style x:Key="A_Style_Flyer_TopStrip_IconBacking" TargetType="local:FZMaterial">
                <Setter Property="Color" Value="{StaticResource H_Color_Primary_Purple}" />
                <Setter Property="Height" Value="38" />
                <Setter Property="Margin" Value="2" />
                <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll1px}" />
            </Style>
        </Style.Resources>
        <Setter Property="Height" Value="{StaticResource A_Double_BucketList_Flyer_Height}" />
        <Setter Property="Width" Value="{StaticResource A_Double_BucketList_Flyer_Width}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Control">
                    <Grid Margin="0">
                        <Grid>
                            <local:FZMaterial Style="{StaticResource A_Style_Flyer_Image}"/>

                            <Grid>
                                <StackPanel x:Name="TopStrip" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="2">
                                    <local:FZMaterial Style="{StaticResource A_Style_Flyer_TopStrip_IconBacking}" Visibility="{Binding PlaysCount, Converter={StaticResource A_Converter_VisibleIfGreaterThanZero}, FallbackValue=Collapsed}">
                                        <StackPanel Orientation="Horizontal" Margin="5,0">
                                            <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Data_Bound/Event_Blueprint/AdditionalInfo/UGC_Plays.png" Width="37" Height="37"/>
                                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_HorizonA}"
                                                Color="{StaticResource H_Color_Primary_Black}"
                                                CapHeight="18" MaxWidth="120"
                                                VerticalAlignment="Center"
                                                Margin="4,0"
                                                Text="{Binding PlaysCount, Converter={StaticResource A_NumUnitConverter_NoUnit_0dp}}" />
                                        </StackPanel>
                                    </local:FZMaterial>

                                    <local:FZMaterial Style="{StaticResource A_Style_Flyer_TopStrip_IconBacking}" Visibility="{Binding LikesCount, Converter={StaticResource A_Converter_VisibleIfGreaterThanZero}, FallbackValue=Collapsed}">
                                        <StackPanel Orientation="Horizontal" Margin="8,0">
                                            <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Anthem/A_Star.png" Width="24.5" Height="24.5"/>
                                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_HorizonA}"
                                                Color="{StaticResource H_Color_Primary_Black}"
                                                CapHeight="18" MaxWidth="120"
                                                VerticalAlignment="Center"
                                                Margin="8,0"
                                                Text="{Binding LikesCount, Converter={StaticResource A_NumUnitConverter_NoUnit_0dp}}" />
                                        </StackPanel>
                                    </local:FZMaterial>
                                </StackPanel>

                                <Decorator HorizontalAlignment="Center"
                                           Height="50"
                                           Margin="0,166,0,0"
                                           Width="316"
                                           VerticalAlignment="Top">
                                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_Flyer_ChallengeTypeName}"/>
                                </Decorator>
                                                             
                                <local:FZMaterial Margin="0,225,0,0"
                                                  VerticalAlignment="Top"
                                                  HorizontalAlignment="Center"
                                                  Width="442"
                                                  Height="248"
                                                  Stretch="Uniform"
                                                  ImageSource="{Binding CarOrdinal, Converter={CarOrdinalConverter}, ConverterParameter=thumbnail}" 
                                                  Visibility="{Binding Downloaded, RelativeSource={RelativeSource Self}, Converter={StaticResource A_FZBooleanToVisibilityConverter_UseHidden}}"/>

                                <Control Template="{StaticResource A_ControlTemplate_Presents}" />
                                <DockPanel Margin="25,492,25,60">
                                    <local:FZTextBlock DockPanel.Dock="Top"
                                                       x:Name="ChallengeNameText"
                                                       Style="{StaticResource A_Style_FZTextBlock_Flyer_EventName_WithMax}"/>
                                    <local:FZTextBlock x:Name="ChallengeDescriptionText"
                                                       Style="{StaticResource A_Style_FZTextBlock_EventDescription_Poster}"
                                                       MaxWidth="300"
                                                       Margin="0,15,0,0"/>
                                </DockPanel>

                                <Control Template="{StaticResource A_ControlTemplate_Flyer_BrandingContent}"
                                         Style="{StaticResource A_Style_ScreenReader_EventFlyer_Details}" />

                                <!--UGC - Likes and Distance-->
                                <Control Template="{StaticResource A_ControlTemplate_LikesAndDistance}" />

                                <!--DLC icon-->
                                <local:FZMaterial HorizontalAlignment="Right" 
                                                  VerticalAlignment="Bottom" 
                                                  Margin="0,0,4,111" 
                                                  Height="94"
                                                  Width="94"
                                                  Visibility="{Binding MediaTrack, Converter={StaticResource A_Converter_MediaTrackToVisibility}, FallbackValue=Collapsed}"/>

                                <Control Template="{StaticResource A_ControlTemplate_Races_FooterContent_BucketList}" />
                            </Grid>
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <ControlTemplate x:Key="A_ControlTemplate_Control_BucketListFlyer_Internal" TargetType="Control">
        <ControlTemplate.Resources>
            <RotateTransform3D x:Key="A_RotateTransform3D_FlyerFlip180"  CenterX="{StaticResource A_Double_BucketList_Flyer_FlyerHalfWidth}">
                <RotateTransform3D.Rotation>
                    <AxisAngleRotation3D Axis="0,-1,0" Angle="180" />
                </RotateTransform3D.Rotation>
            </RotateTransform3D>
        </ControlTemplate.Resources>
        <Grid >
            <Grid x:Name="RotationContainer">
                <local:ZPanel.Transform>
                    <RotateTransform3D CenterX="{StaticResource A_Double_BucketList_Flyer_FlyerHalfWidth}">
                        <RotateTransform3D.Rotation>
                            <AxisAngleRotation3D x:Name="FlyerRotation"  Axis="0,-1,0" Angle="{Binding FontSize, RelativeSource={RelativeSource TemplatedParent}}" />
                        </RotateTransform3D.Rotation>
                    </RotateTransform3D>
                </local:ZPanel.Transform>

                <Grid x:Name="FrontFace">
                    <ContentControl Style="{StaticResource A_Style_Control_BucketListFlyer_Front}" />
                </Grid>
            </Grid>
        </Grid>
        <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding Angle, ElementName=FlyerRotation, Converter={StaticResource A_CompareConverter}, ConverterParameter=90}" Value="-1">
                <Setter TargetName="FrontFace" Property="Visibility" Value="Visible" />
            </DataTrigger>
            <DataTrigger Binding="{Binding Angle, ElementName=FlyerRotation, Converter={StaticResource A_CompareConverter}, ConverterParameter=90}" Value="1">
                <Setter TargetName="FrontFace" Property="Visibility" Value="Collapsed" />
            </DataTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!--AdditionalInfo Popup-->
    
    <ControlTemplate x:Key="A_ControlTemplate_BucketList_AdditionalInfo_FlyerPopup">
        <Grid>
            <FZMaterial x:Name="ShadowMaterial"
                        Margin="-24"
                        Style="{StaticResource H_Style_FZMaterial_ShadowBase_ForSubgraph}"/>
            <FZMaterial>
                <FZMaterial.Style>
                    <Style TargetType="FZMaterial">
                        <Setter Property="HorizontalAlignment" Value="Left" />
                        <Setter Property="Color" Value="{StaticResource H_Color_Primary_White}" />
                        <Setter Property="Preset" Value="{StaticResource A_Preset_AdditionalInfoPanel_Background_Opaque}" />
                    </Style>
                </FZMaterial.Style>
                <local:FZMaterial Preset="{RoundtangleStroke CornerRadius=0, Thickness=1}" Color="{StaticResource H_Color_Primary_Black}"
                                  HorizontalAlignment="Center"
                                  Margin="12">
                    <DockPanel Margin="1" HorizontalAlignment="Center"
                               SnapsToDevicePixels="True">

                        <Control Template="{StaticResource A_ControlTemplate_AdditionalInfo_IconAndName_BucketList}" DockPanel.Dock="Top"
                                 local:BindingProxy.A="{StaticResource A_Style_FZMaterial_FooterSeasonIcon}"
                                 local:BindingProxy.B="{Binding EventSeason, Converter={StaticResource A_Converter_Season_To_String_Global}}"/>
                        <Control Template="{StaticResource A_ControlTemplate_AdditionalInfo_IconAndName_BucketList}" DockPanel.Dock="Top"
                                 local:BindingProxy.A="{StaticResource A_Style_FZMaterial_FooterCustomRouteIcon_BucketList}"
                                 local:BindingProxy.B="{local:Loc EventBlueprint.IDS_RouteBlueprint_CustomRoute}"/>
                        <Control Template="{StaticResource A_ControlTemplate_AdditionalInfo_IconAndName_BucketList}" DockPanel.Dock="Top"
                                 local:BindingProxy.A="{StaticResource A_Style_FZMaterial_FooterHasPropsIcon_BucketList}"
                                 local:BindingProxy.B="{local:Loc EventBlueprint.IDS_RouteBlueprint_HasProps}"/>
                        <Control Template="{StaticResource A_ControlTemplate_AdditionalInfo_IconAndName_BucketList}" DockPanel.Dock="Top"
                                 local:BindingProxy.A="{StaticResource A_Style_FZMaterial_FooterNoRewindIcon_BucketList}"
                                 local:BindingProxy.B="{local:Loc EventBlueprint.IDS_RouteBlueprint_NoRewind}"/>
                        <Control Template="{StaticResource A_ControlTemplate_AdditionalInfo_IconAndName_BucketList}" DockPanel.Dock="Top"
                                 local:BindingProxy.A="{StaticResource A_Style_FZMaterial_FooterPlayedIcon}"
                                 local:BindingProxy.B="{local:Loc EventBlueprint.IDS_Played}"/>
                        <Control Template="{StaticResource A_ControlTemplate_AdditionalInfo_IconAndName_BucketList}" DockPanel.Dock="Top"
                                 local:BindingProxy.A="{StaticResource A_Style_FZMaterial_FooterFavoriteIcon}"
                                 local:BindingProxy.B="{local:Loc EventBlueprint.IDS_RouteBlueprint_Favorited}"/>

                    </DockPanel>
            
                </local:FZMaterial>
            </local:FZMaterial>
        
            <local:FZMaterial x:Name="Arrows"
                              Style="{StaticResource A_Style_FZMaterial_AdditionalInfo_Arrows}" />
        </Grid>
    </ControlTemplate>

    <Style x:Key="A_Style_Event_BucketListInfo_FlyerPopup" TargetType="Control">
        <Setter Property="Template" Value="{StaticResource A_ControlTemplate_BucketList_AdditionalInfo_FlyerPopup}"/>
        <Setter Property="Width" Value="317"/>
        <Setter Property="VerticalAlignment" Value="Top"/>
        <Setter Property="Margin" Value="0,33"/>
    </Style>
    

    <Storyboard x:Key="A_Storyboard_ShowBackOfFlyer_Bucketlist">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="FontSize"
                                       Storyboard.TargetName="Flyer">
            <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="180.0">
                <EasingDoubleKeyFrame.EasingFunction>
                    <ExponentialEase EasingMode="EaseInOut" />
                </EasingDoubleKeyFrame.EasingFunction>
            </EasingDoubleKeyFrame>
        </DoubleAnimationUsingKeyFrames>
        <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="Focusable"
                                       Storyboard.TargetName="Flyer">
            <DiscreteBooleanKeyFrame KeyTime="0:0:0.0" Value="False"/>
            <DiscreteBooleanKeyFrame KeyTime="0:0:0.3" Value="True"/>
        </BooleanAnimationUsingKeyFrames>
        <StringAnimationUsingKeyFrames Storyboard.TargetName="Audio"
                                       Storyboard.TargetProperty="(local:AudioEvent.SoundName)">
            <DiscreteStringKeyFrame KeyTime="0" Value="/Master/UI/PreRace/HZ3_SFX_UI_PreRace_ViewFlyerBack" />
        </StringAnimationUsingKeyFrames>
    </Storyboard>

    <Storyboard x:Key="A_Storyboard_ShowFrontOfFlyer_Bucketlist">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="FontSize"
                                       Storyboard.TargetName="Flyer">
            <EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0.0">
                <EasingDoubleKeyFrame.EasingFunction>
                    <ExponentialEase EasingMode="EaseInOut" />
                </EasingDoubleKeyFrame.EasingFunction>
            </EasingDoubleKeyFrame>
        </DoubleAnimationUsingKeyFrames>
        <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="Focusable"
                                       Storyboard.TargetName="Flyer">
            <DiscreteBooleanKeyFrame KeyTime="0:0:0.0" Value="False"/>
            <DiscreteBooleanKeyFrame KeyTime="0:0:0.3" Value="True"/>
        </BooleanAnimationUsingKeyFrames>
        <StringAnimationUsingKeyFrames Storyboard.TargetName="Audio"
                                       Storyboard.TargetProperty="(local:AudioEvent.SoundName)">
            <DiscreteStringKeyFrame KeyTime="0" Value="/Master/UI/PreRace/HZ3_SFX_UI_PreRace_ViewFlyerFront" />
        </StringAnimationUsingKeyFrames>
    </Storyboard>


    <Storyboard x:Key="A_Storyboard_ShowBackOfFlyer_Bucketlist_Instant">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="FontSize"
                                       Storyboard.TargetName="Flyer">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0.0" Value="180.0" />
        </DoubleAnimationUsingKeyFrames>
        <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="Focusable"
                                       Storyboard.TargetName="Flyer">
            <DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="True"/>
        </BooleanAnimationUsingKeyFrames>
    </Storyboard>

    <Storyboard x:Key="A_Storyboard_ShowFrontOfFlyer_Bucketlist_Instant">
        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="FontSize"
                                       Storyboard.TargetName="Flyer">
            <DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0.0" />
        </DoubleAnimationUsingKeyFrames>
        <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="Focusable"
                                       Storyboard.TargetName="Flyer">
            <DiscreteBooleanKeyFrame KeyTime="0:0:0.0" Value="True"/>
        </BooleanAnimationUsingKeyFrames>
    </Storyboard>

</ResourceDictionary>
