<UserControl
	DataContext="{Binding (HUDData.Data), RelativeSource={RelativeSource Self}}" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	xmlns:local="clr-namespace:ForzaUI"
	mc:Ignorable="d"
	x:Class="ForzaUI.HUDProximityRadarControl"
	x:Name="UserControl"
    VerticalAlignment="Stretch"
    HorizontalAlignment="Stretch">
    <UserControl.Resources>
        <MappingConverter x:Key="A_Converter_ProximityCarType_to_Color" CheckEnumKey="ProximityCarTypeEnum">
            <MappingConverterEntry Key="{x:Static ProximityCarTypeEnum.Player}" Value="{StaticResource A_Color_RadarCarType_Player}"/>
            <MappingConverterEntry Key="{x:Static ProximityCarTypeEnum.Opponent}" Value="{StaticResource A_Color_RadarCarType_Opponent}"/>
            <MappingConverterEntry Key="{x:Static ProximityCarTypeEnum.Friendly}" Value="{StaticResource A_Color_RadarCarType_Friendly}"/>
            <MappingConverterEntry Key="{x:Static ProximityCarTypeEnum.Traffic}" Value="{StaticResource A_Color_RadarCarType_Traffic}"/>
        </MappingConverter>
    </UserControl.Resources>

        <ContentControl HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" x:Name="PART_LayoutRoot">
        <VisualStateManager.VisualStateGroups   >
            <VisualStateGroup x:Name="VisualStateGroup">
                <VisualState x:Name="PART_Hidden" />
                <VisualState x:Name="PART_Shown"/>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
        <Grid>
            <ItemsControl x:Name="ItemsControl_HudRadar" ItemsSource="{Binding RadarItems}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="White" RenderTransformOrigin="0.5,1" Focusable="False">
                <ItemsControl.RenderTransform>
                    <TransformGroup>
                        <SkewTransform/>
                        <RotateTransform/>
                        <TranslateTransform/>
                    </TransformGroup>
                </ItemsControl.RenderTransform>
                <ItemsControl.Template>
                    <ControlTemplate TargetType="{x:Type ItemsControl}">
                        <Grid IsItemsHost="True"/>
                    </ControlTemplate>
                </ItemsControl.Template>
                <ItemsControl.ItemContainerStyle>
                    <Style TargetType="{x:Type ContentPresenter}">
                        <Setter Property="ContentTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <Grid x:Name="Grid_Rotation" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
                                        <Grid.RenderTransform>
                                            <TransformGroup>
                                                <RotateTransform Angle="{Binding RadarCarRotation}"/>
                                                <TranslateTransform X="{Binding LocationX}" Y="{Binding LocationY}"/>
                                            </TransformGroup>
                                        </Grid.RenderTransform>
                                        <Grid x:Name="Grid_Opacity" Opacity="1" HorizontalAlignment="Right" VerticalAlignment="Center" Width="16" Height="26">
                                            <local:FZMaterial x:Name="Image_rectangle_player" 
                                                              ImageSource="/ForzaUI;component/Textures/Anthem/HUD/Radar_Rectangle_Cars.png"
                                                              Stretch="Uniform" 
                                                              Opacity="{Binding CarOpacity}"
                                                              Color="{Binding ProximityCarType, Converter={StaticResource A_Converter_ProximityCarType_to_Color}}"
                                                              />
                                        </Grid>
                                    </Grid>
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ItemsControl.ItemContainerStyle>
            </ItemsControl>
            <!-- /ItemsControl_HudRadar -->

        </Grid>
    </ContentControl>

</UserControl>