<EstateMenu xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            x:Class="ForzaUI.A_EstateMenu"
            Style="{StaticResource A_Style_Page_Generic}"
            DataContext="{Binding RelativeSource={RelativeSource Self}}"
            AttachedTileMenu.TileMenuNavigationManager="{TileMenuNavigationManager}">

    <Page.Resources>
        <ResourceDictionary>
            <MultiConverter x:Key="A_Converter_VisitorPermission_To_String_To_Upper">
                <MultiConverterEntry Converter="{StaticResource A_Converter_VisitorPermission_To_String}"/>
                <MultiConverterEntry Converter="{StaticResource A_StringToUpper}"/>
            </MultiConverter>
        </ResourceDictionary>
    </Page.Resources>
    
    <UIPageTransitionManager.TransitionManager>
        <UIPageTransitionManager Preset="{StaticResource A_UIPageTransitionManagerPreset_TiledSubMenu}" />
    </UIPageTransitionManager.TransitionManager>
    <Grid KeyboardNavigation.DirectionalNavigation="Contained"
          x:Name="PART_LayoutRoot">
        <!--Main Tile Content -->
       <Control Style="{StaticResource A_Style_Control_ScreenBackground}" />
        <!-- Bars -->
        <PlayerBarControl Style="{StaticResource A_Style_PlayerBarControl}"
                        x:Name="TopBar" />
        <ContentControl Style="{StaticResource A_Style_ButtonBar}"
                        x:Name="BottomBar">
            <ControllerButtonPanel x:Name="PART_HelpPanel"
                                 Style="{StaticResource A_Style_ControllerButtonPanel_Default}">
                <ControllerButtonControl Button="A"
                                         Description="{Loc HelpButtons.IDS_Select}" />
                <ControllerButtonControl Button="B"
                                         Description="{Loc HelpButtons.IDS_Back}" />
            </ControllerButtonPanel>
        </ContentControl>
        <Decorator
            Style="{StaticResource A_Style_FrameworkElement_LayoutRoot}"
            Width="Auto"
            Height="Auto"
            HorizontalAlignment="Center"
            VerticalAlignment="Center">
            <StackPanel
                Style="{StaticResource A_Style_FrameworkElement_TiledMenuTransition_0}">
                <ContentControl
                    Content="{Loc ScreenTitles.IDS_EstateMenu}"
                    Style="{StaticResource A_Style_ContentControl_ScreenTitleBlock}"
                    HorizontalAlignment="Left"
                    Width="364"
                    Margin="0,0,0,20"/>
                <Decorator
                    x:Name="PART_MenuContent">
                    <Grid
                        Style="{StaticResource H_Style_Grid_5TileMenu}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <FZButton
                            x:Name="PART_TravelToEstate"
                            TileMenuNavigationManager.TextColorScheme="{Static TextColorScheme.Light}"
                            Style="{StaticResource H_Style_ImageTile}"
                            Grid.Column="0"
                            Grid.Row="0"
                            Grid.RowSpan="8"
                            Grid.ColumnSpan="1"
                            Command="{Binding TravelToEstateCommand, RelativeSource={RelativeSource AncestorType=Page}}">
                            <FZButton.DataContext>
                                <TileMenuDataItem
                                    Heading="{Loc PlayerEstate.IDS_EstateMenu_TileTitle_TravelToEstate}"
                                    Description="{Loc PlayerEstate.IDS_EstateMenu_TileText_TravelToEstate}"
                                    Icon="Textures\Data_Bound\Estate\EstateMenu\TravelToEstate.png" />
                            </FZButton.DataContext>
                        </FZButton>
                        <FZButton
                            x:Name="PART_EditEstateInfo"
                            Style="{StaticResource H_Style_ImageTile}"
                            Grid.Column="1"
                            Grid.Row="0"
                            Grid.RowSpan="4"
                            Grid.ColumnSpan="3" 
                            Command="{Binding EditEstateInfoCommand, RelativeSource={RelativeSource AncestorType=Page}}"
                            TileMenuNavigationManager.InitialSelection="True">
                            <FZButton.DataContext>
                                <TileMenuDataItem
                                    Heading="{Loc PlayerEstate.IDS_EstateMenu_TileTitle_EditEstateInfo}"
                                    Description="{Loc PlayerEstate.IDS_EstateMenu_TileText_EditEstateInfo}"
                                    Icon="Textures\Data_Bound\Estate\EstateMenu\EditEstateInformation.png" />
                            </FZButton.DataContext>
                        </FZButton>
                        <FZButton
                            x:Name="PART_BrowseCommunityEstates"
                            Style="{StaticResource H_Style_ImageTile}"
                            Grid.Column="1"
                            Grid.Row="4"
                            Grid.RowSpan="4"
                            Grid.ColumnSpan="2" 
                            Command="{Binding BrowseCommunityEstatesCommand, RelativeSource={RelativeSource AncestorType=Page}}">
                            <FZButton.DataContext>
                                <TileMenuDataItem
                                    Heading="{Loc PlayerEstate.IDS_EstateMenu_TileTitle_BrowseCommunityEstates}"
                                    Description="{Loc PlayerEstate.IDS_EstateMenu_TileText_BrowseCommunityEstates}"
                                    Icon="Textures\Data_Bound\Estate\EstateMenu\BrowseCommunityEstates.png" />
                            </FZButton.DataContext>
                        </FZButton>
                        <FZButton
                            x:Name="PART_VisitorPermission"
                            Style="{StaticResource H_Style_ImageTile}"
                            Grid.Column="3"
                            Grid.Row="4"
                            Grid.RowSpan="3"
                            Grid.ColumnSpan="1"
                            Command="{Binding VisitorPermissionCommand, RelativeSource={RelativeSource AncestorType=Page}}"
                            BindingProxy.A="{Binding IsEstateOpen, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_Converter_VisitorPermission_To_String}}">
                            <FZButton.Resources>
                                <Style x:Key="A_Style_FZMaterial_Tiled_Notification_Background" TargetType="{x:Type FZMaterial}">
                                    <Setter Property="Color" Value="{Binding IsEstateOpen, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_Converter_VisitorPermission_To_Background_Color}}"/>
                                </Style>
                                <Style x:Key="A_Style_FZMaterial_Tiled_Notification_Text" TargetType="{x:Type FZTextBlock}">
                                    <Setter Property="Color" Value="{Binding IsEstateOpen, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_Converter_VisitorPermission_To_Text_Color}}"/>
                                    <Setter Property="Text" Value="{Binding IsEstateOpen, RelativeSource={RelativeSource AncestorType=Page}, Converter={StaticResource A_Converter_VisitorPermission_To_String_To_Upper}}"/>
                                </Style>
                                <Margin x:Key="A_Margin_FZButton_Badge">18,-32,0,0</Margin>
                                <Double x:Key="A_Double_Badge_Width">95</Double>
                                <Style x:Key="H_Style_NotificationBadge_Tile_Button"
                                       TargetType="{Type ContentControl}"
                                       BasedOn="{StaticResource H_Style_NotificationBadge_Square}">
                                    <Setter Property="HorizontalAlignment" Value="Left"/>
                                    <Setter Property="VerticalAlignment" Value="Bottom"/>
                                    <Setter Property="Template" Value="{StaticResource A_ControlTemplate_FZButton_Badge}" />
                                    <Setter Property="Margin" Value="0,-18,0,0" />
                                </Style>
                            </FZButton.Resources>
                            <FZButton.DataContext>
                                <TileMenuDataItem
                                    Heading="{Loc PlayerEstate.IDS_EstateMenu_TileTitle_VisitorPermission}" />
                            </FZButton.DataContext>
                        </FZButton>
                        <FZButton
                            x:Name="PART_ResetEstate"
                            Style="{StaticResource H_Style_SingleLineTextTile}"
                            Grid.Column="3"
                            Grid.Row="7"
                            Grid.RowSpan="1"
                            Grid.ColumnSpan="1"
                            Command="{Binding ResetEstateCommand, RelativeSource={RelativeSource AncestorType=Page}}">
                            <FZButton.DataContext>
                                <TileMenuDataItem
                                    Heading="{Loc PlayerEstate.IDS_EstateMenu_TileTitle_ResetEstate}" />
                            </FZButton.DataContext>
                        </FZButton>
                        <FZButton
                            x:Name="PART_EmptyEstate"
                            Style="{StaticResource H_Style_SingleLineTextTile}"
                            Grid.Column="4"
                            Grid.Row="7"
                            Grid.RowSpan="1"
                            Grid.ColumnSpan="1"
                            Command="{Binding EmptyEstateCommand, RelativeSource={RelativeSource AncestorType=Page}}">
                            <FZButton.DataContext>
                                <TileMenuDataItem
                                    Heading="{Loc PlayerEstate.IDS_EstateMenu_TileTitle_EmptyEstate}" />
                            </FZButton.DataContext>
                        </FZButton>
                        <FZButton
                            x:Name="PART_ManageYourEstates"
                            Style="{StaticResource H_Style_ImageTile}"
                            Grid.Column="4"
                            Grid.Row="0"
                            Grid.RowSpan="7"
                            Grid.ColumnSpan="1"
                            Command="{Binding ManageEstatesCommand, RelativeSource={RelativeSource AncestorType=Page}}">
                            <FZButton.DataContext>
                                <TileMenuDataItem
                                    Heading="{Loc PlayerEstate.IDS_EstateMenu_TileTitle_ManageYourEstates}"
                                    Icon="Textures\Data_Bound\Estate\EstateMenu\ManageEstates.png" />
                            </FZButton.DataContext>
                        </FZButton>
                    </Grid>
                </Decorator>
            </StackPanel>
        </Decorator>
    </Grid>
</EstateMenu>
