<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:System="clr-namespace:System;assembly=mscorlib"
                    xmlns:local="clr-namespace:ForzaUI"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Double x:Key="A_Double_DetailsPanel_Width">364</Double>
    <Double x:Key="A_Double_DetailsPanel_TopPanel_Height">320</Double>

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

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

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

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

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

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

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

    <Style x:Key="A_Style_FZRun_StartingGrid_KINGSMALL" TargetType="local:FZRun"
            BasedOn="{StaticResource A_Style_FZRun_StartingGrid_KING}" >
        <Setter Property="FontSize" Value="33" />
    </Style>

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

    <Style x:Key="A_Style_FZRun_StartingGrid_BOLD" TargetType="local:FZRun" >
        <Setter Property="FontFamily" Value="Horizon_C" />
    </Style>
    
    <MappingConverter x:Key="A_MappingConverter_Instruction">
        <MappingConverterEntry Key="{NoCase TEAMA}" Value="{StaticResource A_Style_FZRun_StartingGrid_TEAMA}" />
        <MappingConverterEntry Key="{NoCase TEAMB}" Value="{StaticResource A_Style_FZRun_StartingGrid_TEAMB}" />
        <MappingConverterEntry Key="{NoCase POINTS}" Value="{StaticResource A_Style_FZRun_StartingGrid_POINTS}" />
        <MappingConverterEntry Key="{NoCase SMALL}" Value="{StaticResource A_Style_FZRun_StartingGrid_SMALL}" />
        <MappingConverterEntry Key="{NoCase INFECTED}" Value="{StaticResource A_Style_FZRun_StartingGrid_INFECTED}" />
        <MappingConverterEntry Key="{NoCase SURVIVOR}" Value="{StaticResource A_Style_FZRun_StartingGrid_SURVIVOR}" />
        <MappingConverterEntry Key="{NoCase KING}" Value="{StaticResource A_Style_FZRun_StartingGrid_KING}" />
        <MappingConverterEntry Key="{NoCase KINGSMALL}" Value="{StaticResource A_Style_FZRun_StartingGrid_KINGSMALL}" />
        <MappingConverterEntry Key="{NoCase FLAGRUSH}" Value="{StaticResource A_Style_FZRun_StartingGrid_FLAGRUSH}" />
        <MappingConverterEntry Key="{NoCase BOLD}" Value="{StaticResource A_Style_FZRun_StartingGrid_BOLD}" />
    </MappingConverter>

    <Style x:Key="A_Style_FZTextBlock_StartingGrid_Instruction" TargetType="local:FZTextBlock"
            BasedOn="{StaticResource A_Style_FZTextBlock_HorizonA}" >
        <Setter Property="CapHeight" Value="16"/>
        <Setter Property="TextWrapping" Value="Wrap"/>
        <Setter Property="Color" Value="{StaticResource A_Color_SubHeader_Text}"/>
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="MarkupConverter" Value="{StaticResource A_MappingConverter_Instruction}" />
    </Style>

    <Style x:Key="A_Style_ContentControl_DetailsHeader_StartingGrid"
        TargetType="ContentControl"
        BasedOn="{StaticResource A_Style_ContentControl_Header}">
        <Style.Resources>
            <Style x:Key="A_Style_ContentControl_Header_StartingGrid"
                TargetType="ContentControl"
                BasedOn="{StaticResource A_Style_ContentControl_Header_Custom}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="ContentControl">
                            <FZMaterial Style="{StaticResource H_Style_Container_DescriptionTitle}"
                                        Height="50">
                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                            </FZMaterial>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </Style.Resources>
        <Setter Property="Margin" Value="0,0,0,5"/>
        <Setter Property="Height" Value="50"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ContentControl">
                    <ContentControl Style="{StaticResource A_Style_ContentControl_Header_StartingGrid}"
                                    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                                    MinWidth="{TemplateBinding MinWidth}">
                        <FZTextBlock Style="{StaticResource H_Style_Text_DescriptionTitle}"
                                    Text="{TemplateBinding Content}" />
                    </ContentControl>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="A_Style_Control_PlayersTeam_Banner" TargetType="Control">
        <Style.Resources>
            <MappingConverter x:Key="A_Converter_TeamColorEnum_to_ColorResource" 
                              Default="{StaticResource A_Color_TileEmpty_Background}" 
                              CheckEnumKey="PlayerTeamBannerColor">
                <MappingConverterEntry Key="{x:Static PlayerTeamBannerColor.RedTeam}"
                                       Value="{StaticResource A_Color_List_TeamA_Background}"/>
                <MappingConverterEntry Key="{x:Static PlayerTeamBannerColor.BlueTeam}"
                                       Value="{StaticResource A_Color_List_TeamB_Background}"/>
            </MappingConverter>
        </Style.Resources>
        <Setter Property="Visibility" Value="{Binding PlayerTeam, FallbackValue=Collapsed, Converter={StaticResource A_StringVisConverter}}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Control">
                    <FZMaterial Color="{Binding TeamColor, Converter={StaticResource A_Converter_TeamColorEnum_to_ColorResource}}"
                                    DockPanel.Dock="Top"
                                    Height="50"
                                    Margin="0,0,0,4">
                            <FZTextBlock Style="{StaticResource A_Style_FZTextBlock_StartingGrid_Instruction}"
                                        Text="{Binding PlayerTeam}"
                                        CapHeight="18"
                                        FontFamily="Horizon_C"/>
                        </FZMaterial>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="A_ControlTemplate_MapView" TargetType="Control">
        <Grid Height="{StaticResource A_Double_DetailsPanel_TopPanel_Height}"
                Margin="0,0,0,4">
        <local:MapViewControllerWindowed x:Name="InstructionPanelMapView"
                                        DataContext="{Binding RouteMap}"
                                        Style="{StaticResource A_Style_MapViewController_UIMap}" />
        <local:MapCustomRenderElement Style="{StaticResource A_Style_MapCustomRenderElement_Leaderboard}"
                                        DataContext="{Binding RouteMap}" 
                                        Width="{StaticResource A_Double_DetailsPanel_Width}" 
                                        Height="324"
                                        MapView="{Binding ElementName=InstructionPanelMapView}"/>
        </Grid>
    </ControlTemplate>

    <ControlTemplate x:Key="A_ControlTemplate_Control_InstructionPanelContent" TargetType="Control">
        <ControlTemplate.Resources>
            <Style x:Key="A_Style_FZRun_Markup_Hightlight" TargetType="{x:Type local:FZRun}">
                <Setter Property="Color"  Value="{StaticResource H_Color_Primary_Green}"/>
            </Style>
            
            <MappingConverter x:Key="A_MarkupConverter_Number_Hightlight">
                <MappingConverterEntry Key="{NoCase NUM}" Value="{StaticResource A_Style_FZRun_Markup_Hightlight}" />
            </MappingConverter>
        </ControlTemplate.Resources>
        <DockPanel Margin="0,0,0,2">
            <Control DockPanel.Dock="Top" 
                     Template="{StaticResource A_ControlTemplate_MapView}"/>
            <Control DockPanel.Dock="Top"
                     Style="{StaticResource A_Style_Control_PlayersTeam_Banner}"/>
            <FZMaterial Style="{StaticResource A_Style_FZMaterial_InstructionPanelBackgroundLast}" 
                        DockPanel.Dock="Bottom"
                        Margin="0,0,0,2"
                        MaxHeight="320">
                <DockPanel VerticalAlignment="Top" 
                            Margin="20">
                    <FZTextBlock DockPanel.Dock="Top"
                                 x:Name="EventMainTitle"
                                 Style="{StaticResource A_Style_FZTextBlock_StartingGrid_Instruction}" 
                                 CapHeight="24"
                                 Text="{Binding TrackName}" 
                                 Margin="0,0,0,15"
                                 Visibility="{Binding Text, RelativeSource={RelativeSource Self}, Converter={StaticResource A_StringVisConverter}}"/>
                    <ContentControl DockPanel.Dock="Top"
                                    Content="{Binding EventMapIcon}"
                                    Style="{StaticResource A_Style_ContentControl_SpatialIcon_ForLeaderboard}"
                                    HorizontalAlignment="Center"
                                    Margin="0,0,0,15"/>
                    <FZTextBlock DockPanel.Dock="Top"
                                 x:Name="EventSubTitle"
                                 Style="{StaticResource A_Style_FZTextBlock_StartingGrid_Instruction}" 
                                 CapHeight="16"
                                 Text="{Binding RaceModeName}" 
                                 Margin="0,0,0,15"
                                 Visibility="{Binding Text, RelativeSource={RelativeSource Self}, Converter={StaticResource A_StringVisConverter}}"/>
                    <FZTextBlock DockPanel.Dock="Top"
                                    Style="{StaticResource A_Style_FZTextBlock_StartingGrid_Instruction}" 
                                    CapHeight="16"
                                    MarkupConverter="{StaticResource A_MarkupConverter_Number_Hightlight}"
                                    MultiStringFormatter.Format="{StaticResource A_String_012FormatString}"
                                    MultiStringFormatter.Param0="{Binding RaceLapNumber}"
                                    MultiStringFormatter.Param1=" - "
                                    MultiStringFormatter.Param2="{Binding RouteMap.Distance}"
                                    Text="{Binding (MultiStringFormatter.Output), RelativeSource={RelativeSource Self}}"/>
                    <StackPanel DockPanel.Dock="Bottom"
                                Visibility="{Binding Instruction1, FallbackValue=Collapsed, Converter={StaticResource A_StringVisConverter}}">
                        <Decorator Height="18" />
                        <FZMaterial Height="2"
                                    Opacity="0.5"/>
                        <Decorator Height="18" />
                        <FZTextBlock Style="{StaticResource A_Style_FZTextBlock_StartingGrid_Instruction}"
                                        FontFamily="Horizon_D"
                                        Text="{Binding Instruction1}" 
                                        CapHeight="14"
                                        TextWrapping="Wrap"
                                        AutoScroll="{StaticResource H_AutoScrollSettings_Default}"
                                        AutoScroll.AllowScrolling="True"
                                        Stretch="None"
                                        MaxHeight="85"/>
                    </StackPanel>
                </DockPanel>
            </FZMaterial>
        </DockPanel>
        <ControlTemplate.Triggers>
            <DataTrigger Binding="{Binding TrackName, Converter={StaticResource H_TrueIfNull}, FallbackValue={StaticResource A_Boolean_True}}" Value="{StaticResource A_Boolean_True}">
                <Setter TargetName="EventMainTitle" Property="Text" Value="{Binding RaceModeName}"/>
                <Setter TargetName="EventSubTitle" Property="Text" Value="{x:Null}"/>
            </DataTrigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
</ResourceDictionary>