<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_TicketWidth">860</System:Double>
    <System:Double x:Key="A_Double_TicketHeight">258</System:Double>
    <System:Double x:Key="A_Double_TicketHeightWithMargin">264</System:Double>
    <local:LinearTransformConverter x:Key="A_LinearTransformConverter_ListHeight"
        Scale="{StaticResource A_Double_TicketHeightWithMargin}"/>
    <Thickness x:Key="A_Thickness_TicketToPrizeBoxBorder">-24</Thickness>
    <local:LinearTransformConverter x:Key="A_LinearTransformConverter_AnimationValueScale"
                                    Scale="{StaticResource A_Double_TicketHeightWithMargin}"
                                    Add="-390.0" />

    <!-- These resources are referenced from the code-behind. Removing them WILL cause a crash. -->
    <PowerEase x:Key="PART_A_EasingFunction_TombolaWindUpEase" Power="2.5" EasingMode="EaseInOut"/>
    <PowerEase x:Key="PART_A_EasingFunction_TombolaLandingEase" Power="2.5"/>
    <ElasticEase x:Key="PART_A_EasingFunction_TombolaLockInEase" Oscillations="3" Springiness="2" EasingMode="EaseOut" />

    <KeyTime x:Key="PART_A_KeyTime_TombolaWindUpTime">0:0:0.66</KeyTime>
    <KeyTime x:Key="PART_A_KeyTime_TombolaLandingTime">0:0:7.00</KeyTime>
    <KeyTime x:Key="PART_A_KeyTime_TombolaLockInTime">0:0:7.57</KeyTime>

    <System:TimeSpan x:Key="PART_A_TimeSpan_TombolaSkipOffset">0:0:6.0</System:TimeSpan>
    <!-- End of resources referenced from code-behind. -->

    <System:TimeSpan x:Key="A_TimeSpan_TombolaSkipDisabledOffset">-0:0:0.233</System:TimeSpan>
    <System:TimeSpan x:Key="A_TimeSpan_TombolaSkipEnabledOffset">0:0:0.0</System:TimeSpan>

    <System:TimeSpan x:Key="A_TimeSpan_TombolaPrizeVideoFadeOutStart">0:0:10.2</System:TimeSpan>
    <System:TimeSpan x:Key="A_TimeSpan_TombolaPrizeVideoFadeOutEnd">0:0:10.5</System:TimeSpan>

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

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaSkipDisabledTime"
        KeyTime="{StaticResource A_KeyTime_TombolaSkipCompleteTime}"
        Offset="{StaticResource A_TimeSpan_TombolaSkipDisabledOffset}"/>

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaSkipEnabledTime"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaWindUpTime}"
        Offset="{StaticResource A_TimeSpan_TombolaSkipEnabledOffset}"/>


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

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaLockInFlashFadeInStart"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaLockInTime}"
        Offset="{StaticResource A_TimeSpan_TombolaFlashOffsetFadeInStart}"/>

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaLockInFlashFadeInEnd"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaLockInTime}"
        Offset="{StaticResource A_TimeSpan_TombolaFlashOffsetFadeInEnd}"/>

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaLockInFlashFadeOutStart"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaLockInTime}"
        Offset="{StaticResource A_TimeSpan_TombolaFlashOffsetFadeOutStart}"/>

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaLockInFlashFadeOutEnd"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaLockInTime}"
        Offset="{StaticResource A_TimeSpan_TombolaFlashOffsetFadeOutEnd}"/>


    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaLitBulbsFadeInStart"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaWindUpTime}"
        Offset="{StaticResource A_TimeSpan_TombolaLitBulbsFadeInStart}"/>

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaLitBulbsFadeInEnd"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaWindUpTime}"
        Offset="{StaticResource A_TimeSpan_TombolaLitBulbsFadeInEnd}"/>

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaLitBulbsFadeOutStart"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaLockInTime}"
        Offset="{StaticResource A_TimeSpan_TombolaLitBulbsFadeOutStart}"/>

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaLitBulbsFadeOutEnd"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaLockInTime}"
        Offset="{StaticResource A_TimeSpan_TombolaLitBulbsFadeOutEnd}"/>

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaLitBulbsMotionEnd"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaLockInTime}"
        Offset="{StaticResource A_TimeSpan_TombolaLitBulbsMotionOffset}"/>

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaPrizeGlowFadeInStart"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaLockInTime}"
        Offset="{StaticResource A_TimeSpan_TombolaPrizeGlowFadeInStart}"/>

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaPrizeGlowFadeInEnd"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaLockInTime}"
        Offset="{StaticResource A_TimeSpan_TombolaPrizeGlowFadeInEnd}"/>

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaPrizeGlowFadeOutStart"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaLockInTime}"
        Offset="{StaticResource A_TimeSpan_TombolaPrizeGlowFadeOutStart}"/>

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaPrizeGlowFadeOutEnd"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaLockInTime}"
        Offset="{StaticResource A_TimeSpan_TombolaPrizeGlowFadeOutEnd}"/>

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaPrizeVideoFadeOutStart"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaLockInTime}"
        Offset="{StaticResource A_TimeSpan_TombolaPrizeVideoFadeOutStart}"/>

    <local:OffsetKeyTime x:Key="A_KeyTime_TombolaPrizeVideoFadeOutEnd"
        KeyTime="{StaticResource PART_A_KeyTime_TombolaLockInTime}"
        Offset="{StaticResource A_TimeSpan_TombolaPrizeVideoFadeOutEnd}"/>

    <Style x:Key="A_Style_FZTextBlock_CreditPrizeDetails_PrizeValue"
        BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}"
        TargetType="{x:Type local:FZTextBlock}">
        <Setter Property="Color"
                Value="{StaticResource A_Color_Tombola_PrizeValue}" />
        <Setter Property="FontSize" Value="144" />
        <Setter Property="Text"
                Value="{Binding PrizeValue, Converter={StaticResource A_NumUnitConverter_NoUnit_0dp}}" />
        <Setter Property="Stretch"
                Value="None" />
        <Setter Property="Effect" Value="{StaticResource A_Effect_HighContrastModeDropShadow}" />
    </Style>

    <Style x:Key="A_Style_FZTextBlock_CarPrizeDetails_CarManufacturer"
           BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}"
           TargetType="{x:Type local:FZTextBlock}">
        <Setter Property="Margin" Value="12" />
        <Setter Property="Stretch" Value="Uniform" />
        <Setter Property="StretchDirection" Value="DownOnly" />
        <Setter Property="TextWrapping" Value="NoWrap" />
        <Setter Property="Color" Value="{StaticResource A_Color_TombolaCarAltText}" />
        <Setter Property="FontSize" Value="42" />
    </Style>

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

    <Style x:Key="A_Style_FZTextBlock_CarPrizeDetails_CarModel"
           BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}"
           TargetType="{x:Type local:FZTextBlock}">
        <Setter Property="Margin" Value="12" />
        <Setter Property="Stretch" Value="Uniform" />
        <Setter Property="StretchDirection" Value="DownOnly" />
        <Setter Property="TextWrapping" Value="Wrap" />
        <Setter Property="Color" Value="{StaticResource A_Color_TombolaCarText}" />
        <Setter Property="LineAdjust" Value="-0.25" />
        <Setter Property="CapHeight" Value="50" />
        <Setter Property="Effect" Value="{StaticResource A_Effect_HighContrastModeDropShadow}" />
    </Style>

    <Style x:Key="A_Style_FZTextBlock_CarPrizeDetails_PrizeRarity"
           BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}"
           TargetType="{x:Type local:FZTextBlock}">
        <Setter Property="Margin" Value="0" />
        <Setter Property="Stretch" Value="Uniform" />
        <Setter Property="StretchDirection" Value="DownOnly" />
        <Setter Property="TextWrapping" Value="NoWrap" />
        <Setter Property="Color" Value="{StaticResource A_Color_TombolaCarText}" />
        <Setter Property="CapHeight" Value="32" />
        <Setter Property="AlignToCapAndBaseLines" Value="True" />
        <Setter Property="Effect" Value="{StaticResource A_Effect_HighContrastModeDropShadow}" />
    </Style>

    <Style x:Key="A_Style_FZTextBlock_CarPrizeDetails_PrizeName"
           BasedOn="{StaticResource A_Style_FZTextBlock_HorizonB}"
           TargetType="{x:Type local:FZTextBlock}">
        <Setter Property="Margin" Value="0" />
        <Setter Property="Stretch" Value="Uniform" />
        <Setter Property="StretchDirection" Value="DownOnly" />
        <Setter Property="TextWrapping" Value="NoWrap" />
        <Setter Property="Color" Value="{StaticResource A_Color_TombolaCarText}" />
        <Setter Property="CapHeight" Value="32" />
        <Setter Property="AlignToCapAndBaseLines" Value="True" />
        <Setter Property="Effect" Value="{StaticResource A_Effect_HighContrastModeDropShadow}" />
    </Style>

    <Style x:Key="A_Style_FZMaterial_TombolaPrizeBG" TargetType="local:FZMaterial">
        <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Tombola/Normal/Prize_BG.png"/>
    </Style>

    <Style x:Key="A_Style_FZMaterial_TombolaGlassMask" TargetType="local:FZMaterial">
        <Setter Property="Preset" Value="{StaticResource A_FZMaterialPresetGlass_Standard}"/>
        <Setter Property="Color" Value="{StaticResource A_Color_GlassPanel_Interactive}"/>
        <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Tombola/Normal/Glass_Mask.png"/>
    </Style>

    <Style x:Key="A_Style_FZMaterial_TombolaPrizeBoxes" TargetType="local:FZMaterial">
        <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Tombola/Normal/Prize_Boxes.png"/>
    </Style>

    <Style x:Key="A_Style_FZMaterial_TombolaLogoFrame" TargetType="local:FZMaterial">
        <Setter Property="Width" Value="540"/>
        <Setter Property="Height" Value="540"/>
        <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Tombola/Normal/Wheelspin_Logo_Frame.png"/>
    </Style>

    <Style x:Key="A_Style_FZMaterial_TombolaLogo" TargetType="local:FZMaterial">
        <Setter Property="Width" Value="540"/>
        <Setter Property="Height" Value="540"/>
        <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Tombola/Normal/Wheelspin_Logo.png"/>
    </Style>

    <local:MappingConverter x:Key="A_Converter_RarityToParticleGlowVisibility" Default="{x:Static Visibility.Hidden}">
        <local:MappingConverterEntry Key="{x:Static local:XAMLRarity.Common}" Value="{x:Static Visibility.Hidden}"/>
        <local:MappingConverterEntry Key="{x:Static local:XAMLRarity.Rare}" Value="{x:Static Visibility.Hidden}"/>
        <local:MappingConverterEntry Key="{x:Static local:XAMLRarity.Epic}" Value="{x:Static Visibility.Hidden}"/>
        <local:MappingConverterEntry Key="{x:Static local:XAMLRarity.Legendary}" Value="{x:Static Visibility.Visible}"/>
        <local:MappingConverterEntry Key="{x:Static local:XAMLRarity.HorizonEdition}" Value="{x:Static Visibility.Visible}"/>
    </local:MappingConverter>

    <DataTemplate DataType="{x:Type local:TombolaTicketCredits}" >
        <Decorator Height="{StaticResource A_Double_TicketHeightWithMargin}">
            <local:FZMaterial Width="{StaticResource A_Double_TicketWidth}"
                    Height="{StaticResource A_Double_TicketHeight}"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Preset="{Binding PrizeRarity, Converter={StaticResource A_Converter_RarityToTombolaPrizeBackgroundGradientPreset}}">
                <local:FZMaterial x:Name="Backing" ImageSource="/ForzaUI;component/Textures/Anthem/Tombola/Normal/Prize_Backing_Credits.png">
                    <StackPanel Orientation="Horizontal"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Style="{StaticResource A_Style_Decorator_TombolaCreditsSkewTransform}">
                        <local:FZMaterial Width="110"
                            Height="110"
                            ImageSource="/ForzaUI;component/Textures/Anthem/Icons/CRIcon/CR_110_FilledCircle.png"
                            VerticalAlignment="Center"/>
                        <Decorator Width="6"/>
                        <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_CreditPrizeDetails_PrizeValue}"
                                           VerticalAlignment="Center" />
                    </StackPanel>
                </local:FZMaterial>
            </local:FZMaterial>
        </Decorator>
    </DataTemplate>

    <GridLength x:Key="A_GridLength_TombolaTicket_PrizeTop">43</GridLength>
    <GridLength x:Key="A_GridLength_TombolaTicket_PrizeBottom">77</GridLength>

    <DataTemplate DataType="{x:Type local:TombolaTicketCar}">
        <Decorator Height="{StaticResource A_Double_TicketHeightWithMargin}">
            <local:FZMaterial Width="{StaticResource A_Double_TicketWidth}"
                    Height="{StaticResource A_Double_TicketHeight}"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Preset="{Binding PrizeRarity, Converter={StaticResource A_Converter_RarityToTombolaPrizeBackgroundGradientPreset}}">
                <local:FZMaterial x:Name="Backing" ImageSource="/ForzaUI;component/Textures/Anthem/Tombola/Normal/Prize_Backing_Car.png">
                    <Grid>
                        <local:FZMaterial Width="431"
                            Height="242"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Center"
                            ImageSource="{Binding ForegroundImage}"
                            Margin="16,-24,16,24" />
                        <Grid Margin="16">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="{StaticResource A_GridLength_TombolaTicket_PrizeTop}"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="{StaticResource A_GridLength_TombolaTicket_PrizeBottom}"/>
                            </Grid.RowDefinitions>
                            <Control Grid.Row="0"
                                Style="{StaticResource A_Style_Control_TombolaHorizonEditionBlammo}"
                                Margin="7"
                                VerticalAlignment="Center"
                                HorizontalAlignment="Left"/>
                            <Decorator Grid.Row="1"
                                HorizontalAlignment="Left"
                                MaxWidth="375">
                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_CarPrizeDetails_CarModel}"
                                    local:TextBlockInlineMarkup.Markup="{Binding CarModel, Converter={StaticResource A_StringToUpper}}"
                                    local:TextBlockInlineMarkup.ResourceBaseName="A_FZRun_CarPrizeDetails_" />
                            </Decorator>
                            <local:FZTextBlock Grid.Row="2"
                                Style="{StaticResource A_Style_FZTextBlock_CarPrizeDetails_CarManufacturer}"
                                HorizontalAlignment="Left"
                                Text="{Binding CarManufacturer, Converter={StaticResource A_StringToUpper}}" />
                        </Grid>
                    </Grid>
                </local:FZMaterial>
            </local:FZMaterial>
        </Decorator>
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding PrizeRarity}" Value="{x:Static local:XAMLRarity.HorizonEdition}">
                <Setter TargetName="Backing" Property="ImageSource" Value="/ForzaUI;component/Textures/Anthem/Tombola/Normal/Prize_Backing_Car_HorizonEdition.png" />
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>
    
    <System:Double x:Key="A_Double_PrizeName_Separator">10</System:Double>
    <System:Double x:Key="A_Double_PrizeName_Separator_CHS">18</System:Double>
    <System:Double x:Key="A_Double_PrizeName_Separator_CHT">18</System:Double>

    <DataTemplate DataType="{x:Type local:TombolaTicketEmote}">
        <Decorator Height="{StaticResource A_Double_TicketHeightWithMargin}">
            <local:FZMaterial Width="{StaticResource A_Double_TicketWidth}"
                    Height="{StaticResource A_Double_TicketHeight}"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Preset="{Binding PrizeRarity, Converter={StaticResource A_Converter_RarityToTombolaPrizeBackgroundGradientPreset}}">
                <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Anthem/Tombola/Normal/Prize_Backing_Generic.png">
                    <Grid>
                        <local:FZMaterial Width="226"
                            Height="226"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Center"
                            ImageSource="{Binding ForegroundImage}"
                            Margin="0,16,170,16"/>
                        <Grid Margin="16">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="{StaticResource A_GridLength_TombolaTicket_PrizeTop}"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="{StaticResource A_GridLength_TombolaTicket_PrizeBottom}"/>
                            </Grid.RowDefinitions>
                            <StackPanel Grid.Row="1"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                MaxWidth="375"
                                Margin="12">
                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_CarPrizeDetails_PrizeRarity}"
                                    Text="{Binding PrizeRarity, Converter={StaticResource A_Converter_RarityToNameString}}"/>
                                <Decorator Height="{local:LocalizedResource A_Double_PrizeName_Separator}" />
                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_CarPrizeDetails_PrizeName}"
                                    Text="{Binding PrizeName, Converter={StaticResource A_StringToUpper}}"/>
                            </StackPanel>
                          <local:FZTextBlock Grid.Row="2"
                              Style="{StaticResource A_Style_FZTextBlock_CarPrizeDetails_CarManufacturer}"
                              HorizontalAlignment="Left"
                              Text="{local:Loc Rivals.IDS_RewardType_Emote}" />
                        </Grid>
                    </Grid>
                </local:FZMaterial>
            </local:FZMaterial>
        </Decorator>
    </DataTemplate>

    <DataTemplate DataType="{x:Type local:TombolaTicketHorn}">
        <Decorator Height="{StaticResource A_Double_TicketHeightWithMargin}">
            <local:FZMaterial Width="{StaticResource A_Double_TicketWidth}"
                    Height="{StaticResource A_Double_TicketHeight}"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Preset="{Binding PrizeRarity, Converter={StaticResource A_Converter_RarityToTombolaPrizeBackgroundGradientPreset}}">
                <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Anthem/Tombola/Normal/Prize_Backing_Horn.png">
                    <Grid>
                        <Grid Margin="16">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="{StaticResource A_GridLength_TombolaTicket_PrizeTop}"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="{StaticResource A_GridLength_TombolaTicket_PrizeBottom}"/>
                            </Grid.RowDefinitions>
                            <StackPanel Grid.Row="1"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                MaxWidth="375"
                                Margin="12">
                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_CarPrizeDetails_PrizeRarity}"
                                    Text="{Binding PrizeRarity, Converter={StaticResource A_Converter_RarityToNameString}}"/>
                                <Decorator Height="{local:LocalizedResource A_Double_PrizeName_Separator}" />
                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_CarPrizeDetails_PrizeName}"
                                    Text="{Binding PrizeName, Converter={StaticResource A_StringToUpper}}"/>
                            </StackPanel>
                          <local:FZTextBlock Grid.Row="2"
                              Style="{StaticResource A_Style_FZTextBlock_CarPrizeDetails_CarManufacturer}"
                              HorizontalAlignment="Left"
                              Text="{local:Loc Rivals.IDS_RewardType_Horn}" />
                        </Grid>
                    </Grid>
                </local:FZMaterial>
            </local:FZMaterial>
        </Decorator>
    </DataTemplate>

    <DataTemplate DataType="{x:Type local:TombolaTicketClothing}">
        <Decorator Height="{StaticResource A_Double_TicketHeightWithMargin}">
            <local:FZMaterial Width="{StaticResource A_Double_TicketWidth}"
                    Height="{StaticResource A_Double_TicketHeight}"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Preset="{Binding PrizeRarity, Converter={StaticResource A_Converter_RarityToTombolaPrizeBackgroundGradientPreset}}">
                <local:FZMaterial ImageSource="/ForzaUI;component/Textures/Anthem/Tombola/Normal/Prize_Backing_Generic.png">
                    <Grid>
                        <local:FZMaterial Width="226"
                            Height="226"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Center"
                            ImageSource="{Binding ForegroundImage}"
                            Margin="0,16,170,16"/>
                        <Grid Margin="16">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="{StaticResource A_GridLength_TombolaTicket_PrizeTop}"/>
                                <RowDefinition Height="*"/>
                                <RowDefinition Height="{StaticResource A_GridLength_TombolaTicket_PrizeBottom}"/>
                            </Grid.RowDefinitions>
                            <StackPanel Grid.Row="1"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center"
                                MaxWidth="375"
                                Margin="12">
                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_CarPrizeDetails_PrizeRarity}"
                                    Text="{Binding PrizeRarity, Converter={StaticResource A_Converter_RarityToNameString}}"/>
                                <Decorator Height="{local:LocalizedResource A_Double_PrizeName_Separator}" />
                                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_CarPrizeDetails_PrizeName}"
                                    Text="{Binding PrizeName, Converter={StaticResource A_StringToUpper}}"/>
                            </StackPanel>
                          <local:FZTextBlock Grid.Row="2"
                              Style="{StaticResource A_Style_FZTextBlock_CarPrizeDetails_CarManufacturer}"
                              HorizontalAlignment="Left"
                              Text="{local:Loc Rivals.IDS_RewardType_Clothing}" />
                        </Grid>
                    </Grid>
                </local:FZMaterial>
            </local:FZMaterial>
        </Decorator>
    </DataTemplate>

    <Style x:Key="A_Style_TicketsList"
        TargetType="ItemsControl"
        BasedOn="{StaticResource A_Style_TicketsList_Base}">
        <Setter Property="Height" Value="{Binding Count, Converter={StaticResource A_LinearTransformConverter_ListHeight}}"/>
    </Style>

    <Style x:Key="A_Style_FrameworkElement_SpinnerContainer"
        TargetType="{x:Type FrameworkElement}">
        <Setter Property="Width" Value="{StaticResource A_Double_TicketWidth}"/>
        <Setter Property="Margin" Value="0,0,221,0"/>
        <Setter Property="HorizontalAlignment" Value="Right"/>
    </Style>

    <ControlTemplate x:Key="A_ControlTemplate_TombolaPanelContents">
        <Grid>
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundGradient}"/>

            <local:FZMaterial x:Name="ParticlesVideoBlock"
                Preset="{StaticResource A_FZMaterialPresetAdditive}"
                Width="1920"
                Height="540"
                Margin="309,0,-309,0"
                CaptureSubgraph="True"
                Opacity="0"
                Visibility="{Binding MostRareWinningTicket.PrizeRarity, Converter={StaticResource A_Converter_RarityToParticleGlowVisibility}}">
                <Grid>
                    <local:FZMediaElement LoadedBehavior="Stop"
                                          UnloadedBehavior="Stop"
                                          Width="1920"
                                          Height="540"
                                          Stretch="UniformToFill"
                                          x:Name="Video"
                                          Tag="SourceNotSet">
                        <FrameworkElement.Style>
                            <Style TargetType="local:FZMediaElement">
                                <Style.Triggers>
                                    <Trigger Property="Tag"
                                             Value="SourceSet">
                                        <Trigger.Setters>
                                            <Setter Property="Source"
                                                    Value="game:/Media/UI/Videos/Stars_Particles.bk2" />
                                        </Trigger.Setters>
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </FrameworkElement.Style>
                    </local:FZMediaElement>
                    <local:FZMaterial Width="100"
                        HorizontalAlignment="Left">
                        <local:FZMaterial.Preset>
                            <local:FZMaterialPresetRoundtangle GradientAngle="90"
                                GradientColorA="#FF000000"
                                GradientColorB="#00000000"/>
                        </local:FZMaterial.Preset>
                    </local:FZMaterial>
                </Grid>
            </local:FZMaterial>

            <!-- Left Panel -->
            <Grid x:Name="LeftPanel" Margin="140,0" HorizontalAlignment="Left">
                <Grid Margin="0,-70,0,0">
                    <ItemsControl Style="{StaticResource A_Style_ItemsControl_TombolaBackgroundSpokes}">
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaBackgroundSpoke}"/>
                    </ItemsControl>

                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaLogoFrame}"/>

                    <ItemsControl x:Name="TombolaLitBulbsContainer"
                        Style="{StaticResource A_Style_ItemsControl_TombolaLitBulbs_Base}">
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaLitBulb}" Opacity="0.2"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaLitBulb}" Opacity="0.4"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaLitBulb}" Opacity="0.6"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaLitBulb}" Opacity="0.8"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaLitBulb}" Opacity="1.0"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaLitBulb}" Opacity="0.8"/>
                        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaLitBulb}" Opacity="0.4"/>
                    </ItemsControl>

                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaLogo}"/>
                </Grid>

                <ContentControl Style="{StaticResource A_Style_ContentControl_TombolaSpinsRemaining}"
                    Content="{Binding SpinsRemaining}"/>
            </Grid>

            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaPrizeBG}"/>

            <!-- Spinner Block -->
            <Decorator x:Name="SpinnerBlock"
                Style="{StaticResource A_Style_FrameworkElement_SpinnerContainer}">
                <Grid ClipToBounds="True" Style="{StaticResource A_Style_Grid_MotionBlur}" Margin="0,-20"
                      local:MotionBlurEffect.MotionBlurPositionYControl="{Binding (Control.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y), ElementName=TicketList}">
                    <ItemsControl DataContext="{Binding TicketLists[0]}"
                        Style="{StaticResource A_Style_TicketsList}"
                        x:Name="TicketList">
                        <ItemsControl.RenderTransform>
                            <TransformGroup>
                                <TranslateTransform Y="{Binding TicketListsTranslateY0, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_LinearTransformConverter_AnimationValueScale}}" />
                            </TransformGroup>
                        </ItemsControl.RenderTransform>
                    </ItemsControl>
                </Grid>
            </Decorator>

            <local:FZMaterialGlassCapture/>

            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaGlassMask}"/>
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaPrizeBoxes}"/>

            <Decorator x:Name="SpinnerGlowBlock"
                Style="{StaticResource A_Style_FrameworkElement_SpinnerContainer}"
                VerticalAlignment="Center"
                Height="{StaticResource A_Double_TicketHeight}"
                Opacity="0">
                <Grid Margin="{StaticResource A_Thickness_TicketToPrizeBoxBorder}">
                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_WinningPrizeSoftGlow}"
                        DataContext="{Binding WinningTickets[0]}"/>
                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_WinningPrizeHardGlow}"
                        DataContext="{Binding WinningTickets[0]}"/>
                </Grid>
            </Decorator>

            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaArrow_Right}"
                Margin="0,0,167,0"/>
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaArrow_Left}"
                Margin="785,0,0,0"/>

            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaLetterboxTint}"
                VerticalAlignment="Bottom" />
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TombolaLetterboxTint}"
                VerticalAlignment="Top" />

            <!--
            <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_PostRacePanel_Vignette}" />
            -->

            <local:FZMaterial x:Name="TombolaFlash"
                Style="{StaticResource A_Style_FZMaterial_TombolaFlash}"/>
            <local:FZMaterial x:Name="TombolaSkipFlash"
                Style="{StaticResource A_Style_FZMaterial_TombolaFlash}"/>
        </Grid>
        <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding AnimationState}" Value="{x:Static local:TombolaAnimationStates.Spinning}">
                <DataTrigger.EnterActions>
                    <local:BeginUIStoryboard x:Name="BeginStoryboard_Tombola">
                        <local:UIStoryboard>
                            <local:UIStoryboard.TriggerAnimation>
                                <local:RaiseFzEvent EventName="SkipEnabled"
                                    local:TriggerAnimation.KeyTime="{StaticResource A_KeyTime_TombolaSkipEnabledTime}"/>
                                <local:RaiseFzEvent EventName="SkipDisabled"
                                    local:TriggerAnimation.KeyTime="{StaticResource A_KeyTime_TombolaSkipDisabledTime}"/>
                                <local:PlayVideoTrigger local:TriggerAnimation.KeyTime="{StaticResource A_KeyTime_TombolaPrizeGlowFadeInStart}"
                                    Storyboard.TargetName="Video" />
                                <local:RaiseFzEvent EventName="PlayWinAudio"
                                    local:TriggerAnimation.KeyTime="{StaticResource A_KeyTime_TombolaPlayWinAudio}"/>
                                <local:RaiseFzEvent EventName="SpinComplete"
                                    local:TriggerAnimation.KeyTime="{StaticResource PART_A_KeyTime_TombolaLockInTime}"/>
                                <local:StartAudioTrigger EventName="/Master/UI/Tombola/HZ2_SFX_HUD_Tombola_Spin_01"
                                    local:TriggerAnimation.KeyTime="0:0:0.0"/>
                            </local:UIStoryboard.TriggerAnimation>

                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Video"
                                                           Storyboard.TargetProperty="Tag">
                                <DiscreteObjectKeyFrame KeyTime="0:0:0"
                                                        Value="SourceNotSet" />
                                <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaPrizeGlowFadeInStart}"
                                                        Value="SourceSet" />
                            </ObjectAnimationUsingKeyFrames>

                            <DoubleAnimationUsingKeyFrames
                                Storyboard.TargetName="TombolaLitBulbsContainer"
                                Storyboard.TargetProperty="(UIElement.Opacity)">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                    Value="0.0"/>
                                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaLitBulbsFadeInStart}"
                                    Value="0.0"/>
                                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaLitBulbsFadeInEnd}"
                                    Value="1.0"
                                    EasingFunction="{local:QuadraticEasing EasingMode=EaseOut}" />
                                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaLitBulbsFadeOutStart}"
                                    Value="1.0"/>
                                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaLitBulbsFadeOutEnd}"
                                    Value="0.0"
                                    EasingFunction="{local:QuadraticEasing EasingMode=EaseIn}" />
                            </DoubleAnimationUsingKeyFrames>
                            <DoubleAnimationUsingKeyFrames
                                Storyboard.TargetName="TombolaLitBulbsContainer"
                                Storyboard.TargetProperty="(FrameworkElement.Tag)">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0.0"
                                    Value="0" />
                                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaLitBulbsMotionEnd}"
                                    Value="{StaticResource A_Double_TombolaLitBulbs_SpinsCount}" 
                                    EasingFunction="{StaticResource PART_A_EasingFunction_TombolaLandingEase}" />
                            </DoubleAnimationUsingKeyFrames>

                            <DoubleAnimationUsingKeyFrames
                                Storyboard.TargetName="SpinnerGlowBlock"
                                Storyboard.TargetProperty="(UIElement.Opacity)">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0.0" Value="0.0"/>
                                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaPrizeGlowFadeInStart}" Value="0.0"/>
                                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaPrizeGlowFadeInEnd}" Value="1.0"/>
                                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaPrizeGlowFadeOutStart}" Value="1.0"/>
                                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaPrizeGlowFadeOutEnd}" Value="0.0"/>
                            </DoubleAnimationUsingKeyFrames>

                            <DoubleAnimationUsingKeyFrames
                                Storyboard.TargetName="ParticlesVideoBlock"
                                Storyboard.TargetProperty="(UIElement.Opacity)">
                                <DiscreteDoubleKeyFrame KeyTime="0:0:0.0" Value="0.0"/>
                                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaPrizeGlowFadeInStart}" Value="1.0"/>
                                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaPrizeVideoFadeOutStart}" Value="1.0"/>
                                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaPrizeVideoFadeOutEnd}" Value="0.0"/>
                            </DoubleAnimationUsingKeyFrames>

                            <DoubleAnimationUsingKeyFrames
                                Storyboard.TargetName="TombolaFlash"
                                Storyboard.TargetProperty="Opacity">
                                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaResetFlashFadeInEnd}"
                                    Value="0.0"
                                    EasingFunction="{local:QuadraticEasing EasingMode=EaseIn}"/>
                                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaLockInFlashFadeInStart}"
                                    Value="0.0"/>
                                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaLockInFlashFadeInEnd}"
                                    Value="1.0"
                                    EasingFunction="{local:QuadraticEasing EasingMode=EaseOut}" />
                                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaLockInFlashFadeOutStart}"
                                    Value="1.0"/>
                                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaLockInFlashFadeOutEnd}"
                                    Value="0.0"
                                    EasingFunction="{local:QuadraticEasing EasingMode=EaseIn}" />
                            </DoubleAnimationUsingKeyFrames>
                        </local:UIStoryboard>
                    </local:BeginUIStoryboard>
                </DataTrigger.EnterActions>
            </DataTrigger>
            <DataTrigger Binding="{Binding AnimationState}" Value="{x:Static local:TombolaAnimationStates.Hiding}">
                <DataTrigger.EnterActions>
                    <local:BeginUIStoryboard>
                        <local:UIStoryboard>
                            <local:UIStoryboard.TriggerAnimation>
                                <local:StopVideoTrigger local:TriggerAnimation.KeyTime="{StaticResource A_KeyTime_TombolaResetTime}"
                                    Storyboard.TargetName="Video" />
                                <local:RaiseFzEvent EventName="HideComplete"
                                    local:TriggerAnimation.KeyTime="{StaticResource A_KeyTime_TombolaResetTime}"/>
                            </local:UIStoryboard.TriggerAnimation>

                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Video"
                                                           Storyboard.TargetProperty="Tag">
                                <DiscreteObjectKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaResetTime}"
                                                        Value="SourceNotSet" />
                            </ObjectAnimationUsingKeyFrames>

                            <DoubleAnimationUsingKeyFrames Storyboard.TargetName="TombolaFlash"
                                Storyboard.TargetProperty="Opacity">
                                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaResetFlashFadeInStart}"
                                    Value="0.0"/>
                                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaResetFlashFadeInEnd}"
                                    Value="1.0"
                                    EasingFunction="{local:LinearEasing}"/>
                                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaResetFlashFadeOutStart}"
                                    Value="1.0"/>
                            </DoubleAnimationUsingKeyFrames>
                        </local:UIStoryboard>
                    </local:BeginUIStoryboard>
                </DataTrigger.EnterActions>
            </DataTrigger>
            <DataTrigger Binding="{Binding AnimationState}" Value="{x:Static local:TombolaAnimationStates.Skipping}">
                <DataTrigger.EnterActions>
                    <local:BeginUIStoryboard>
                        <local:UIStoryboard>
                            <local:UIStoryboard.TriggerAnimation>
                                <local:StopAudioTrigger EventName="/Master/UI/Tombola/HZ2_SFX_HUD_Tombola_Spin_01"
                                    local:TriggerAnimation.KeyTime="0:0:0.0"/>
                                <local:StartAudioTrigger EventName="AudioUITrigger_WheelSpin_Skip"
                                    local:TriggerAnimation.KeyTime="0:0:0.0"/>
                                <local:RaiseFzEvent EventName="SkipComplete"
                                    local:TriggerAnimation.KeyTime="{StaticResource A_KeyTime_TombolaResetTime}"/>
                            </local:UIStoryboard.TriggerAnimation>

                            <DoubleAnimationUsingKeyFrames
                                Storyboard.TargetName="TombolaSkipFlash"
                                Storyboard.TargetProperty="Opacity">
                                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaResetFlashFadeInStart}"
                                    Value="0.0"/>
                            <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaResetFlashFadeInEnd}"
                                    Value="1.0"
                                    EasingFunction="{local:QuadraticEasing EasingMode=EaseOut}" />
                                <DiscreteDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaResetFlashFadeOutStart}"
                                    Value="1.0"/>
                                <EasingDoubleKeyFrame KeyTime="{StaticResource A_KeyTime_TombolaResetFlashFadeOutEnd}"
                                    Value="0.0"
                                    EasingFunction="{local:QuadraticEasing EasingMode=EaseIn}" />
                            </DoubleAnimationUsingKeyFrames>
                        </local:UIStoryboard>
                    </local:BeginUIStoryboard>
                </DataTrigger.EnterActions>
            </DataTrigger>
            <DataTrigger Binding="{Binding IsSkipComplete}" Value="True">
                <DataTrigger.EnterActions>
                    <SeekStoryboard BeginStoryboardName="BeginStoryboard_Tombola"
                        Offset="{StaticResource PART_A_TimeSpan_TombolaSkipOffset}"
                        Origin="{x:Static TimeSeekOrigin.BeginTime}"/>
                </DataTrigger.EnterActions>
            </DataTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style x:Key="A_Style_Control_TombolaPanelContents"
        TargetType="{x:Type Control}">
        <Setter Property="Width" Value="1920"/>
        <Setter Property="Height" Value="540"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="ClipToBounds" Value="True"/>
        <Setter Property="Template" Value="{StaticResource A_ControlTemplate_TombolaPanelContents}"/>
    </Style>

</ResourceDictionary>
