<Page x:Class="ForzaUI.Scenes.Anthem.A_DesignSearch"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:System="clr-namespace:System;assembly=mscorlib"
      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"
      Style="{StaticResource A_Style_Page_Generic}"
      DataContext="{Binding RelativeSource={RelativeSource Self}}">

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

    <Page.Resources>
        <Style x:Key="A_Style_ListBoxItem_DesignSearch_NotShareCode"
               BasedOn="{StaticResource A_Style_ListBoxItem_TextMenu_NotFocusable}"
               TargetType="ListBoxItem">
            <Setter Property="IsEnabled"
                    Value="False" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding SelectedIndex, ElementName=PART_ShareCodeSpinner}" Value="0">
                    <Setter Property="IsEnabled"
                            Value="True" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_SpinnerControl_DesignSearch_NotShareCode"
               BasedOn="{StaticResource A_Style_SpinnerControl_Default_InItemsList}"
               TargetType="local:SpinnerControl">
            <Setter Property="Tag"
                    Value="Locked" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding SelectedIndex, ElementName=PART_ShareCodeSpinner}" Value="0">
                    <Setter Property="Tag"
                            Value="" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

        <Style x:Key="A_Style_SpinnerControl_DesignSearch_NotShareCodeEllipsis"
               BasedOn="{StaticResource A_Style_SpinnerControl_Default_InItemsList_Ellipsis}"
               TargetType="local:SpinnerControl">
            <Setter Property="Tag"
                       Value="Locked" />
            <Style.Triggers>
                <DataTrigger Binding="{Binding SelectedIndex, ElementName=PART_ShareCodeSpinner}" Value="0">
                    <Setter Property="Tag"
                            Value="" />
                </DataTrigger>
            </Style.Triggers>
        </Style>

    </Page.Resources>
    <Grid x:Name="PART_LayoutRoot">
        <!-- Background Blur -->
        <local:FZMaterialGlassCapture />
        <local:FZMaterial Style="{StaticResource A_Style_FZMaterial_Popup_Background}"/>

        <!-- Help Button Bar -->
        <ContentControl x:Name="BottomBar" Style="{StaticResource A_Style_ButtonBar}">
            <ContentControl x:Name="PART_DefaultHelpPanel"
                            local:ControllerButtonPanel.ADescription="{local:Loc HelpButtons.IDS_Select}"
                            local:ControllerButtonPanel.BDescription="{local:Loc HelpButtons.IDS_Back}"
                            local:ControllerButtonPanel.YDescription="{local:Loc HelpButtons.IDS_ResetDefault}"
                            Style="{StaticResource A_Style_ContentControl_DefaultButtonBar}" />
        </ContentControl>

        <Grid Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}">
            <StackPanel Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Width="{StaticResource A_Double_SettingsBox_Width}">
                <ContentControl Style="{StaticResource A_Style_ContentControl_PopupTitleBlock}"
                                    Content="{Binding Title}" />
                <ContentControl Style="{StaticResource A_Style_ContentControl_PopupContentBlock}">
                    <Grid Margin="2,0">
                        <StackPanel Visibility="{Binding IsSearching, Converter={StaticResource A_Converter_BoolToVis}}">
                            <local:FZTextBlock Text="{Binding SearchMessage}"
                                                   Style="{StaticResource A_Style_FZTextBlock_PopupText}" Margin="20,0,20,38"/>
                            <ProgressBar x:Name="IdleIndicator"
                                             IsIndeterminate="True"
                                             Style="{StaticResource A_Style_ProgressBar_WaitSpinner}"
                                             Height="56"
                                             Margin="0,0,0,16" />
                        </StackPanel>
                        <Grid>
                            <StackPanel x:Name="MainContent"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            Style="{StaticResource A_Style_FrameworkElement_DefaultTransition_0}">
                                <local:CommonListBox x:Name="PART_CommonListBox_SpinnerContainer"
                                                 Visibility="{Binding IsSearching, Converter={StaticResource A_Converter_BoolToVis_Inverted}}"
                                                 Style="{StaticResource A_Style_ListBox_TextMenu_Default}"
                                                 Focusable="False"
                                                 KeyboardNavigation.DirectionalNavigation="Contained">
                                    <ListBoxItem Style="{StaticResource A_Style_ListBoxItem_DesignSearch_NotShareCode}">
                                        <local:SpinnerControl x:Name="PART_MinCostSpinner"
                                                              Label="{local:Loc Storefront.IDS_MinCost}"
                                                              Style="{StaticResource A_Style_SpinnerControl_DesignSearch_NotShareCode}"
                                                              ItemsSource="{Binding MinCostOptions}"
                                                              Visibility="{Binding ShowMinCost, Converter={StaticResource A_Converter_BoolToVis}}" />
                                    </ListBoxItem>
                                    <ListBoxItem Style="{StaticResource A_Style_ListBoxItem_DesignSearch_NotShareCode}">
                                        <local:SpinnerControl x:Name="PART_MaxCostSpinner"
                                                              Label="{local:Loc Storefront.IDS_MaxCost}"
                                                              Style="{StaticResource A_Style_SpinnerControl_DesignSearch_NotShareCode}"
                                                              ItemsSource="{Binding MaxCostOptions}"
                                                              Visibility="{Binding ShowMaxCost, Converter={StaticResource A_Converter_BoolToVis}}" />
                                    </ListBoxItem>
                                    <ListBoxItem Style="{StaticResource A_Style_ListBoxItem_DesignSearch_NotShareCode}">
                                        <local:SpinnerControl x:Name="PART_LayersSpinner"
                                                            Label="{local:Loc Storefront.IDS_Layers}"
                                                            Style="{StaticResource A_Style_SpinnerControl_DesignSearch_NotShareCode}"
                                                            ItemsSource="{Binding LayersOptions}"
                                                            Visibility="{Binding ShowLayers, Converter={StaticResource A_Converter_BoolToVis}}" />
                                    </ListBoxItem>
                                    <ListBoxItem Style="{StaticResource A_Style_ListBoxItem_DesignSearch_NotShareCode}">
                                        <local:SpinnerControl x:Name="PART_MakeSpinner"
                                                            Label="{local:Loc Storefront.IDS_Make}"
                                                            Style="{StaticResource A_Style_SpinnerControl_DesignSearch_NotShareCode}"
                                                            ItemsSource="{Binding MakeOptions}"
                                                            Visibility="{Binding ShowMake, Converter={StaticResource A_Converter_BoolToVis}}" />
                                    </ListBoxItem>

                                    <ListBoxItem Style="{StaticResource A_Style_ListBoxItem_DesignSearch_NotShareCode}">
                                        <local:SpinnerControl x:Name="PART_ModelSpinner"
                                                            Label="{local:Loc Storefront.IDS_Model}"
                                                            Style="{StaticResource A_Style_SpinnerControl_DesignSearch_NotShareCode}"
                                                            ItemsSource="{Binding ModelOptions}"
                                                            Visibility="{Binding ShowModel, Converter={StaticResource A_Converter_BoolToVis}}" />
                                    </ListBoxItem>

                                    <ListBoxItem Style="{StaticResource A_Style_ListBoxItem_DesignSearch_NotShareCode}">
                                        <local:SpinnerControl x:Name="PART_CarClassSpinner"
                                                            Label="{local:Loc Storefront.IDS_CarClass}"
                                                            Style="{StaticResource A_Style_SpinnerControl_DesignSearch_NotShareCode}"
                                                            ItemsSource="{Binding CarClassOptions}"
                                                            Visibility="{Binding ShowCarClass, Converter={StaticResource A_Converter_BoolToVis}}" />
                                    </ListBoxItem>

                                    <ListBoxItem Style="{StaticResource A_Style_ListBoxItem_DesignSearch_NotShareCode}">
                                        <local:SpinnerControl x:Name="PART_Keyword1Spinner"
                                                            Label="{local:Loc Storefront.IDS_Keyword1}"
                                                            Style="{StaticResource A_Style_SpinnerControl_DesignSearch_NotShareCode}"
                                                            ItemsSource="{Binding Keyword1Options}" />
                                    </ListBoxItem>

                                    <ListBoxItem Style="{StaticResource A_Style_ListBoxItem_DesignSearch_NotShareCode}">
                                        <local:SpinnerControl x:Name="PART_Keyword2Spinner"
                                                            Label="{local:Loc Storefront.IDS_Keyword2}"
                                                            Style="{StaticResource A_Style_SpinnerControl_DesignSearch_NotShareCode}"
                                                            ItemsSource="{Binding Keyword2Options}" />
                                    </ListBoxItem>

                                    <ListBoxItem Style="{StaticResource A_Style_ListBoxItem_DesignSearch_NotShareCode}"> 
                                        <local:SpinnerControl x:Name="PART_CreatorSpinner"
                                                            Label="{local:Loc Storefront.IDS_LabelCreatorButton}"
                                                            Style="{StaticResource A_Style_SpinnerControl_DesignSearch_NotShareCode}"
                                                            ItemsSource="{Binding LabelCreatorOptions}"
                                                            Visibility="{Binding ShowCreator, Converter={StaticResource A_Converter_BoolToVis}}" />
                                    </ListBoxItem>

                                    <ListBoxItem Style="{StaticResource A_Style_ListBoxItem_DesignSearch_NotShareCode}">
                                        <local:SpinnerControl x:Name="PART_DescriptionSpinner"
                                                            Label="{local:Loc Storefront.IDS_LabelDescriptionButton}"
                                                            Style="{StaticResource A_Style_SpinnerControl_DesignSearch_NotShareCodeEllipsis}"
                                                            ItemsSource="{Binding LabelDescriptionOptions}" 
                                                            Visibility="{Binding ShowDescription, Converter={StaticResource A_Converter_BoolToVis}}" />
                                    </ListBoxItem>

                                    <ListBoxItem Style="{StaticResource A_Style_ListBoxItem_TextMenu_NotFocusable}">
                                        <local:SpinnerControl x:Name="PART_ShareCodeSpinner"
                                                            Label="{local:Loc Storefront.IDS_LabelShareCode}"
                                                            Style="{StaticResource A_Style_SpinnerControl_Default_InItemsList_Ellipsis}"
                                                            ItemsSource="{Binding ShareCodeOptions}"
                                                            Visibility="{Binding ShowShareCode, Converter={StaticResource A_Converter_BoolToVis}}" />
                                    </ListBoxItem>

                                    <ListBoxItem Style="{StaticResource A_Style_ListBoxItem_TextMenu_NotFocusable}" Margin="0, 6, 0, 3">
                                        <local:FZButton x:Name="PART_ActionButton"
                                                Content="{Binding ActionText}"
                                                Template="{StaticResource A_ControlTemplate_Button_TextMenu}" />
                                    </ListBoxItem>
                                </local:CommonListBox>
                            </StackPanel>
                        </Grid>
                    </Grid>
                </ContentControl>
            </StackPanel>
        </Grid>
    </Grid>
</Page>
