<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"
      xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
      mc:Ignorable="d"
      Style="{StaticResource A_Style_Page_Generic}"
      x:Class="ForzaUI.Scenes.Anthem.UserContentPropPrefab"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">

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

    <Page.Resources>
        <ResourceDictionary>
            <DataTemplate x:Key="A_DataTemplate_Carousel_PropPrefabItem">
                <Grid>
                    <Control Template="{StaticResource A_ControlTemplate_Carousel_PropPrefabItem}" />
                    <local:FZMaterial x:Name="FavoritedIcon"
                                      Width="23" Height="23"
                                      Color="{StaticResource H_Color_Primary_Pink}"
                                      Visibility="{Binding IsFavorite, Converter={StaticResource A_FZBooleanToVisibilityConverter}}"
                                      ImageSource="/ForzaUI;component/Textures/Data_Bound/CreativeHub/FollowedHeart.png"
                                      HorizontalAlignment="Right"
                                      VerticalAlignment="Bottom"
                                      Margin="8"/>
                </Grid>
            </DataTemplate>
        </ResourceDictionary>
    </Page.Resources>

    <Grid x:Name="LayoutRoot">
        <!-- Background Blur -->
        <Control Style="{StaticResource A_Style_Control_ScreenBackground}" />

        <local:PlayerBarControl x:Name="TopBar"
                                Style="{StaticResource A_Style_PlayerBarControl_WithTokens}" />

        <ContentControl x:Name="BottomBar"
                        Style="{StaticResource A_Style_ButtonBar}">
            <local:ControllerButtonPanel x:Name="PART_HelpPanel"
                                         HorizontalAlignment="Left"
                                         VerticalAlignment="Bottom"
                                         Background="{x:Null}">
                <local:ControllerButtonControl Button="A"
                                               Description="{local:Loc HelpButtons.IDS_Download}"
                                               Visibility="{Binding PropPrefabCollectionDataSource.IsDownloading, Converter={StaticResource A_Converter_BoolToVis}}" />
                <local:ControllerButtonControl Button="B"
                                               Description="{local:Loc HelpButtons.IDS_Back}" />
                <local:ControllerButtonControl Button="X"
                                               Description="{local:Loc HelpButtons.IDS_PropPrefabOptions}" />
                <local:ControllerButtonControl Button="Back"
                                               Description="{local:Loc HelpButtons.IDS_Search}" />
                <local:ControllerButtonControl Button="R3"
                                               Visibility="{Binding CanShowShareCode, Converter={StaticResource A_Converter_BoolToVis}}"
                                               Description="{local:Loc HelpButtons.IDS_ViewShareCode}" />
            </local:ControllerButtonPanel>
        </ContentControl>

        <Border Style="{StaticResource A_Style_Border_ScenePadding_Opus}">
            <StackPanel Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}"
                        VerticalAlignment="Center"
                        HorizontalAlignment="Center">
                <StackPanel Margin="15,0,0,0">
                    <ContentControl 
                        x:Name="ContentControl_SceneTitle"
                        Content="{Binding Title}"
                        local:BindingProxy.A="/ForzaUI;component/Textures/Anthem/Icons/Titles/Painting.png"
                        Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                        HorizontalAlignment="Left" />

                    <FZTabButtonsSelector
                        x:Name="PART_PropPrefabCategoryList"
                        ItemsSource="{Binding PropPrefabCategories, RelativeSource={RelativeSource AncestorType=Page}}"
                        Style="{StaticResource H_Style_TabBar}"
                        SelectedItem="{Binding SelectedCategory}"
                        HorizontalAlignment="Left"/>

                </StackPanel>
                <Grid Margin="15,0,0,0">
                    <local:WrapListBox Style="{StaticResource H_Style_FullScreenCarousel_TwoRows}"
                                       ItemTemplate="{StaticResource A_DataTemplate_Carousel_PropPrefabItem}"
                                       ItemsSource="{Binding PropPrefabCollectionDataSource, RelativeSource={RelativeSource AncestorType=Page}}"
                                       SelectionLimitTop="310"
                                       Margin="-18,0,0,0"
                                       ItemContainerStyle="{StaticResource H_Style_ContentControl_CustomisationItem_ContainerStyle_TransparentBackground}"
                                       x:Name="PART_ItemList"/>
                    <ContentControl Template="{StaticResource A_ControlTemplate_UserContent_SidePanel}" 
                                    Style="{StaticResource A_Style_ControlTemplate_UserContent_SidePanel_TwoRowsCarousel}"
                                    DataContext="{Binding SelectedItem, ElementName=PART_ItemList}"
                                    VerticalAlignment="Top">
                        <StackPanel x:Name="PopularityInfo_Panel"
                                    Orientation="Vertical"
                                    VerticalAlignment="Top"
                                    Margin="12,0"
                                    DataContext="{Binding SelectedItem, ElementName=PART_ItemList}">
                            <HeaderedContentControl Header="{Loc Storefront.IDS_Rank}"
                                                    Style="{StaticResource H_Style_UserContent_SidePanelItemMultilineWithHeader}"
                                                    Content="{Binding CreatorRank, Converter={NumUnitConverter FractionDigits=0}, FallbackValue=-}"/>
                            <FZMaterial Style="{StaticResource H_Style_StatDivider_InfoPanel}"/>
                             <HeaderedContentControl Style="{StaticResource H_Style_UserContent_SidePanelItemWithHeader}"
                                                    Header="{Loc Storefront.IDS_Downloads}"
                                                    Content="{Binding DownloadCount, Converter={NumUnitConverter FractionDigits=0}, FallbackValue=-}"/>
                            <FZMaterial Style="{StaticResource H_Style_StatDivider_InfoPanel}" />
                            <HeaderedContentControl Style="{StaticResource H_Style_UserContent_SidePanelItemWithHeader}"
                                                    Header="{Loc Storefront.IDS_Likes}"
                                                    Content="{Binding LikeCount, Converter={NumUnitConverter FractionDigits=0}, FallbackValue=-}"/>
                            <FZMaterial Style="{StaticResource H_Style_StatDivider_InfoPanel}" />
                            <HeaderedContentControl Style="{StaticResource H_Style_UserContent_SidePanelItemFollower}"
                                                    Header="{Loc Storefront.IDS_LabelCreatorNotFollowed }"
                                                    Content="/ForzaUI;component/Textures/Data_Bound/CreativeHub/FollowedHeart.png"/>
                            <FZMaterial Style="{StaticResource H_Style_StatDivider_InfoPanel}" />
                        </StackPanel>
                    </ContentControl>

                    <local:NavigationArrows Style="{StaticResource A_Style_Control_NavigationArrows}"
                                            Template="{StaticResource A_ControlTemplate_NavigationArrows_FullscreenCarousel}"
                                            Height="205"
                                            Margin="290,0,0,80"
                                            VerticalAlignment="Center"
                                            CanSelectPrev="{Binding CanSelectPrev, ElementName=PART_ItemList}"
                                            CanSelectNext="{Binding CanSelectNext, ElementName=PART_ItemList}"
                                            ScrollPagePrevCommand="{Binding ScrollPagePrevCommand, ElementName=PART_ItemList}"
                                            ScrollPageNextCommand="{Binding ScrollPageNextCommand, ElementName=PART_ItemList}" />
                </Grid>
            </StackPanel>
        </Border>
    </Grid>
</Page>
