<Page xmlns:local="clr-namespace:ForzaUI"
      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"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      x:Class="ForzaUI.A_LiveryPaintSelect"
      mc:Ignorable="d"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">

    <Page.Resources>
        <System:String x:Key="A_String_AdvancedSupport">+</System:String>
        <DataTemplate x:Key="A_DataTemplate_LiveryPaintItemData">
            <Grid>
                <local:FZMaterial ImageSource="{Binding IconPath}"
                                Margin="10" />
                <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_HorizonA}"
                                CapHeight="24"
                                Text="{Binding Source={StaticResource A_String_AdvancedSupport}}"
                                Color="#333333"
                                Margin="5,7"
                                AlignToCapAndBaseLines="True"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Bottom"
                                Visibility="{Binding SupportsSubgroups, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
            </Grid> 
        </DataTemplate>
    </Page.Resources>

    <local:UIPageTransitionManager.TransitionManager>
        <local:UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_Menu}" />
    </local:UIPageTransitionManager.TransitionManager>

    <Grid>
        <!-- Bars -->
        <ContentControl x:Name="BottomBar"
                        Style="{StaticResource A_Style_ButtonBar}">
            <local:ControllerButtonPanel x:Name="HelpPanel"
                                         Style="{StaticResource A_Style_ControllerButtonPanel_Default}">
                <local:ControllerButtonControl Button="A"
                                               Description="{local:Loc HelpButtons.IDS_Select}" />
                <local:ControllerButtonControl Button="B"
                                               Description="{local:Loc HelpButtons.IDS_Back}" />
                <local:ControllerButtonControl Button="Back"
                                               Description="{local:Loc HelpButtons.IDS_Save}" />
                <local:ControllerButtonControl Button="R3"
                                               Description="{local:Loc HelpButtons.IDS_AdvancedCamera}"
                                               Visibility="{Binding IsControllerActiveInput, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_FZBooleanToVisibilityConverter}}" />
            </local:ControllerButtonPanel>
        </ContentControl>

        <Border x:Name="LayoutRoot"
                Style="{StaticResource A_Style_Border_ScenePadding_Opus}">
            <DockPanel Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}"
                       Width="{StaticResource A_Double_Carousel_Square_10Item_Total_Width}"
                       HorizontalAlignment="Center">

                <local:RoutedEventCommand x:Name="ButtonBarDisableMouseCursorMovement"
                                          RoutedEvent="UIElement.MouseEnter"
                                          Command="{Binding DisableCameraFocus,RelativeSource={RelativeSource AncestorType=Page}}" />
                <local:RoutedEventCommand x:Name="ButtonBarEnableMouseCursorMovement"
                                          RoutedEvent="UIElement.MouseLeave"
                                          Command="{Binding EnableCameraFocus,RelativeSource={RelativeSource AncestorType=Page}}" />
                <ContentControl Template="{StaticResource A_Template_ContentControl_SelectorContainer_PageButtons}"
                                DockPanel.Dock="Bottom">
                    <local:WrapListBox x:Name="PART_ItemsSelector_PaintMenu"
                                       Style="{StaticResource A_Style_Carousel_Square_10Item}"
                                       ItemTemplate="{StaticResource A_DataTemplate_LiveryPaintItemData}"
                                       ItemsSource="{Binding PaintMenuCollection}"
                                       SelectedIndex="0"
                                       local:RoutedEventCommand.Action="{Binding ElementName=ButtonBarDisableMouseCursorMovement}"
                                       local:RoutedEventCommand.Action2="{Binding ElementName=ButtonBarEnableMouseCursorMovement}" />
                </ContentControl>

                <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_FlatPanel_Tile}" Height="73"
                                        Color="{StaticResource A_Color_Header_Background}"
                                        x:Name="MenuHeader"
                                        DockPanel.Dock="Bottom"
                                        HorizontalAlignment="Left"
                                        VerticalAlignment="Bottom"
                                        Margin="0,0,0,18"
                                        Visibility="{Binding Text, ElementName=Textblock_Title, Converter={StaticResource A_StringVisConverter}}">
                    <local:FZTextBlock Style="{StaticResource A_Style_FZTextBlock_HeaderBlock}"
                                            Text="{Binding SelectedItem.ItemName, ElementName=PART_ItemsSelector_PaintMenu}"
                                            CapHeight="24" TextWrapping="Wrap"
                                            Focusable="False" />
                </local:FZMaterial>
            </DockPanel>
        </Border>
    </Grid>
</Page>
