<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    mc:Ignorable="d"
                    xmlns:local="clr-namespace:ForzaUI;assembly=">

    <Style x:Key="A_Style_FZMaterial_RivalDirtyIcon" TargetType="local:FZMaterial">
        <Setter Property="Visibility" Value="{Binding Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"/>
        <Setter Property="ImageSourceNoPreload" Value="/ForzaUI;component/Textures/Anthem/Icons/Dirty_Lap.png" />
        <Setter Property="Width" Value="25"/>
        <Setter Property="Height" Value="25"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="Margin" Value="6,0,0,0"/>
    </Style>

    <Style x:Key="A_Style_FZMaterial_RivalDirtyIconSmall" TargetType="local:FZMaterial">
        <Setter Property="Visibility" Value="{Binding Tag, RelativeSource={RelativeSource Self}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"/>
        <Setter Property="ImageSourceNoPreload" Value="/ForzaUI;component/Textures/Anthem/Icons/RivalsLeaderboard/Dirty_Lap.png" />
        <Setter Property="Margin" Value="5,0,0,0"/>
        <Setter Property="Width" Value="22"/>
        <Setter Property="Height" Value="22"/>
    </Style>

    <Style TargetType="{x:Type local:FZRun}" x:Key="A_Style_FZRun_Details_HIGHLIGHT">
        <Setter Property="Color" Value="{StaticResource H_Color_Primary_Green}"/>
    </Style>

    <MappingConverter x:Key="A_MappingConverter_RivalsMarkup">
        <MappingConverterEntry Key="{NoCase HIGHLIGHT}" Value="{StaticResource A_Style_FZRun_Details_HIGHLIGHT}" />
    </MappingConverter>

    <Style x:Key="A_Style_FZTextBlock_RivalInfoLabel" BasedOn="{StaticResource A_Style_FZTextBlock_Heading_Small_Tight}" TargetType="local:FZTextBlock">
        <Setter Property="Color" Value="{StaticResource A_Color_ScreenTitle_Text}"/>
        <Setter Property="TextWrapping" Value="NoWrap"/>
        <Setter Property="HorizontalAlignment" Value="Left"/>
        <Setter Property="MarkupConverter" Value="{StaticResource A_MappingConverter_RivalsMarkup}"/>
        <Setter Property="FontSize" Value="24"/>
    </Style>

    <Style x:Key="A_Style_FZTextBlock_RivalsRouteName" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_HorizonC}">
        <Setter Property="Color" Value="#ffffffff"/>
        <Setter Property="CapHeight" Value="67"/>
        <Setter Property="Stretch" Value="None"/>
        <Setter Property="AutoScroll" Value="{StaticResource H_AutoScrollSettings_Horizontal_Title}"/>
        <Setter Property="AutoScroll.AllowScrolling" Value="True"/>
    </Style>



    <Style x:Key="A_Style_FZTextBlock_RivalsRouteDistanceSmall" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_RivalInfoLabel}">
        <Setter Property="Color" Value="{StaticResource H_Color_Primary_Black}"/>
        <Setter Property="CapHeight" Value="17"/>
    </Style>

    <Style x:Key="A_Style_FZTextBlock_RivalsRouteDistanceLarge" TargetType="{x:Type local:FZTextBlock}" BasedOn="{StaticResource A_Style_FZTextBlock_RivalInfoLabel}">
        <Setter Property="CapHeight" Value="19"/>
        <Setter Property="FontFamily" Value="Horizon_B"/>
        <Setter Property="TrackingAdjust" Value="0.025"/>
        <Setter Property="Color" Value="{StaticResource A_Color_Body_Text}"/>
    </Style>

    <Style x:Key="A_Style_FZMaterial_AssistsIcon" TargetType="local:FZMaterial">
        <Setter Property="Height" Value="40" />
        <Setter Property="Width" Value="40" />
        <Setter Property="Color" Value="{StaticResource H_Color_Primary_Black}" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Data_Bound/Checkbox/Radio_Off.png" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsLocalPlayer}" Value="True">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_LocalPlayer_Text}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding IsKeyboardFocusWithin, RelativeSource={RelativeSource FindAncestor, AncestorType=ListBoxItem}}" Value="True">
                <Setter Property="Color"
                        Value="{StaticResource A_Color_HighlightText}" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="A_Style_FZMaterial_AssistsIconABS" TargetType="local:FZMaterial" BasedOn="{StaticResource A_Style_FZMaterial_AssistsIcon}">
        <Setter Property="Visibility" Value="Collapsed" />
        <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Data_Bound/Checkbox/Radio_On.png" />
        <Style.Triggers>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding UsedABS}" Value="True"/>
                    <Condition Binding="{Binding UsedAutoBrake}" Value="False"/>
                </MultiDataTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible" />
            </MultiDataTrigger>
            <MultiDataTrigger>
                <MultiDataTrigger.Conditions>
                    <Condition Binding="{Binding UsedABS}" Value="False"/>
                    <Condition Binding="{Binding UsedAutoBrake}" Value="False"/>
                </MultiDataTrigger.Conditions>
                <Setter Property="Visibility" Value="Visible" />
                <Setter Property="ImageSource" Value="/ForzaUI;component/Textures/Data_Bound/Checkbox/Radio_Off.png" />
            </MultiDataTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="A_Style_FZMaterial_AssistsIconAutoBrake" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_LeaderboardRow}">
        <Setter Property="Visibility" Value="Collapsed" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding UsedAutoBrake}" Value="True">
                <Setter Property="Visibility" Value="Visible" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="A_Style_FZTextBlock_Gear" TargetType="local:FZTextBlock" BasedOn="{StaticResource A_Style_FZTextBlock_LeaderboardRow}">
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Center"/>
        <Setter Property="FontFamily" Value="Horizon_B"/>
        <Setter Property="Text" Value="{local:Loc PreRaceMenu.IDS_StartingGrid_Gear_Manual}"/>
        <Style.Triggers>
            <DataTrigger Binding="{Binding UsedClutch}" Value="True">
                <Setter Property="Text" Value="{local:Loc PreRaceMenu.IDS_StartingGrid_Gear_ManualClutch}" />
            </DataTrigger>
            <DataTrigger Binding="{Binding UsedAutoShift}" Value="True">
                <Setter Property="Text" Value="{local:Loc PreRaceMenu.IDS_StartingGrid_Gear_Automatic}" />
            </DataTrigger>
        </Style.Triggers>
    </Style>

    <local:FZMaterialPresetRoundtangleStroke x:Key="A_FZMaterialPresetRoundtangleStroke_MapBorder"
        Thickness="1"/>

    <local:FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_FlatPanel_RivalsDistanceGap"
        BasedOn="{StaticResource A_FZMaterialPreset_FlatPanel_Base}"
        CornerRadius="8,0,0,0"/>

    <DataTemplate x:Key="A_ControlTemplate_Control_RivalsItemContent">
        <DataTemplate.Resources>
                <FZMaterialPresetRoundtangle x:Key="A_FZMaterialPresetRoundtangle_Item_Background_Preset"
                                             BasedOn="{StaticResource A_FZMaterialPreset_FlatPanel_Base}"
                                             CornerRadius="8"/>
        </DataTemplate.Resources>
        <Grid>
            <local:FZMaterial Preset="{StaticResource A_FZMaterialPresetRoundtangle_Item_Background_Preset}"
                              Visibility="{Binding SingleRoute, FallbackValue=Visible, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}">
            <Grid Margin="10">
                <FZMaterial Preset="{StaticResource A_FZMaterialPresetRoundtangleStroke_MapBorder}" 
                            Color="#ffafa5af">
                            <FZMaterial Color="#ff000000" 
                                        ImageSource="/ForzaUI;component/Textures/Anthem/Rivals/CarouselGrid.png"/>
                </FZMaterial>

                    <!-- This is used to blank out the grid near the route length status box, but the map route should draw on top of it -->
                    <FZMaterial Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_RivalsDistanceGap}"
                                VerticalAlignment="Bottom"
                                HorizontalAlignment="Right"
                                Margin="0,0,-0.5,-0.5"
                                Width="{Binding ActualWidth, ElementName=LengthStatus}"
                                Height="{Binding ActualHeight, ElementName=LengthStatus}" />
                    <MapViewControllerWindowed x:Name="ThumbnailMapView"
                                               DataContext="{Binding ThumbnailMapData}"
                                               Style="{StaticResource A_Style_MapViewController_UIMap}"
                                               MinMapHeight="1000"
                                               InterpolationTime="0" />
                    <local:MapCustomRenderElement Style="{StaticResource A_Style_MapCustomRenderElement_UIMap}"
                                                  DataContext="{Binding ThumbnailMapData}"
                                                  MapView="{Binding ElementName=ThumbnailMapView}" />

                    <Grid VerticalAlignment="Bottom"
                          HorizontalAlignment="Right"
                          Margin="0,0,-0.5,-0.5"
                          x:Name="LengthStatus">
                        <local:FZTextBlock Text="{Binding ThumbnailMapData.Distance, Converter={StaticResource A_StringToUpper}}"
                                           Style="{StaticResource A_Style_FZTextBlock_RivalsRouteDistanceSmall}"
                                           Margin="5,5,0.5,0.5"
                                           Color="{StaticResource H_Color_Primary_Black}" />
                    </Grid>
            </Grid>
        </local:FZMaterial>

            <!-- Class-based display -->
            <local:FZMaterial Visibility="{Binding SingleRoute, FallbackValue=Collapsed, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                              Preset="{StaticResource A_FZMaterialPresetRoundtangle_Item_Background_Preset}"
                              ImageSource="{Binding Thumbnail}">
                <local:FZTextBlock Text="{local:Loc Rivals.IDS_DesignSpecial}"
                                   Style="{StaticResource A_Style_FZTextBlock_HorizonA}"
                                   Color="{StaticResource A_Color_Tile_Text}"
                                   Margin="27"
                                   CapHeight="15"
                                   TextAlignment="Center"
                                   VerticalAlignment="Bottom"
                                   Visibility="{Binding SingleRouteDesignSpecial, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"/>
            </local:FZMaterial>
        </Grid>
    </DataTemplate>


    <ItemsPanelTemplate x:Key="A_Template_RaceIconStackPanel">
        <StackPanel IsItemsHost="True" Orientation="Horizontal" />
    </ItemsPanelTemplate>

    <DataTemplate x:Key="A_Template_RaceIconImage">
        <local:FZMaterial ImageSourceNoPreload="{Binding}" Width="60" Height="60" Margin="1,0"/>
    </DataTemplate>

    <ControlTemplate x:Key="A_ControlTemplate_RivalsDestinationTile"
                    TargetType="Control">
        <Grid Style="{StaticResource A_Style_FrameworkElement_DefaultTransition}"
              local:UIPageTransitionManager.TransitionIndex="{Binding (local:UIPageTransitionManager.TransitionIndex), RelativeSource={RelativeSource TemplatedParent}}">
            <Grid>
                <Grid>
                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_TileBackground_NoAlternate}"
                                      Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll4px}"
                                      Visibility="{Binding UseAlternateColors, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}" />

                    <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_LockableImageTileBackground}"
                                      Preset="{StaticResource A_FZMaterialPresetRoundtangle_FlatPanel_OuterAll4px}"
                                      ImageSource="{Binding Image}" />

                    <Grid Visibility="{Binding UseAlternateColors, Converter={StaticResource A_FZBooleanToVisibilityConverter_Inverse}}">
                        <StackPanel VerticalAlignment="Bottom"
                                    Margin="22,0,0,0">
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_TileTitle}"
                                            HorizontalAlignment="Left"
                                            Color="{StaticResource H_Color_Primary_White}"
                                            CapHeight="37"
                                            FontFamily="Horizon_C"
                                            Text="{Binding Title}"/>
                            <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_TileText_ImageTile}"
                                            HorizontalAlignment="Left"
                                            Margin="0,16,0,17"
                                            Color="{StaticResource H_Color_Primary_Yellow}"
                                            CapHeight="19"
                                            FontFamily="Horizon_B"
                                            Text="{Binding Subtitle}"/>
                        </StackPanel>
                    </Grid>
                </Grid>
                <StrokeHighlightControl Style="{StaticResource A_Style_ContentControl_TileSelectionStroke}" Focusable="False" />
                <ContentControl Content="{Binding (local:BindingProxy.A), RelativeSource={RelativeSource TemplatedParent}}"
                                Style="{StaticResource H_Style_NotificationBadge}"
                                VerticalAlignment="Bottom"
                                HorizontalAlignment="Right"
                                Margin="0,0,13,68"
                                Width="43"
                                Height="43" />
            </Grid>
        </Grid>
    </ControlTemplate>


</ResourceDictionary>