<?xml version="1.0" encoding="utf-8" ?>
<winuiex:WindowEx
    x:Class="Microsoft.CmdPal.UI.Settings.SettingsWindow"
    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:local="using:Microsoft.CmdPal.UI.Settings"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:text="using:Windows.UI.Text"
    xmlns:ui="using:CommunityToolkit.WinUI"
    xmlns:winuiex="using:WinUIEx"
    Title="SettingsWindow"
    Width="1280"
    Height="720"
    MinWidth="480"
    MinHeight="480"
    Activated="Window_Activated"
    Closed="Window_Closed"
    mc:Ignorable="d">
    <winuiex:WindowEx.SystemBackdrop>
        <MicaBackdrop />
    </winuiex:WindowEx.SystemBackdrop>
    <Grid x:Name="RootElement">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <TitleBar
            x:Name="AppTitleBar"
            BackRequested="TitleBar_BackRequested"
            IsBackButtonVisible="{x:Bind NavFrame.CanGoBack, Mode=OneWay}"
            IsTabStop="False"
            PaneToggleRequested="AppTitleBar_PaneToggleRequested">
            <TitleBar.Resources>
                <!--  Override default WinUI 3 style  -->
                <x:Double x:Key="TitleBarCompactHeight">40</x:Double>
            </TitleBar.Resources>
            <TitleBar.IconSource>
                <ImageIconSource ImageSource="ms-appx:///Assets/icon.svg" />
            </TitleBar.IconSource>
        </TitleBar>
        <NavigationView
            x:Name="NavView"
            Grid.Row="1"
            CompactModeThresholdWidth="1007"
            DisplayModeChanged="NavView_DisplayModeChanged"
            ExpandedModeThresholdWidth="1007"
            IsBackButtonVisible="Collapsed"
            IsPaneToggleButtonVisible="False"
            IsSettingsVisible="False"
            ItemInvoked="NavView_ItemInvoked"
            Loaded="NavView_Loaded">
            <NavigationView.Resources>
                <SolidColorBrush x:Key="NavigationViewContentBackground" Color="Transparent" />
                <SolidColorBrush x:Key="NavigationViewContentGridBorderBrush" Color="Transparent" />
                <Thickness x:Key="NavigationViewHeaderMargin">15,0,0,0</Thickness>
            </NavigationView.Resources>
            <NavigationView.MenuItems>
                <NavigationViewItem
                    x:Name="GeneralPageNavItem"
                    x:Uid="Settings_GeneralPage_NavigationViewItem_General"
                    Icon="{ui:FontIcon Glyph=&#xE80F;}"
                    Tag="General" />
                <NavigationViewItem
                    x:Name="AppearancePageNavItem"
                    x:Uid="Settings_GeneralPage_NavigationViewItem_Appearance"
                    Icon="{ui:FontIcon Glyph=&#xE790;}"
                    Tag="Appearance" />
                <NavigationViewItem
                    x:Name="ExtensionPageNavItem"
                    x:Uid="Settings_GeneralPage_NavigationViewItem_Extensions"
                    Icon="{ui:FontIcon Glyph=&#xEA86;}"
                    Tag="Extensions" />
                <!--  xF596 is HolePunchLandscapeTop  -->
                <NavigationViewItem
                    x:Name="DockSettingsPageNavItem"
                    x:Uid="Settings_GeneralPage_NavigationViewItem_Dock"
                    Icon="{ui:FontIcon Glyph=&#xF596;}"
                    Tag="Dock">
                    <NavigationViewItem.InfoBadge>
                        <InfoBadge Style="{StaticResource NewInfoBadge}" />
                    </NavigationViewItem.InfoBadge>
                </NavigationViewItem>
                <!--  "Internal Tools" page item is added dynamically from code  -->
            </NavigationView.MenuItems>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid Padding="16,0">
                    <BreadcrumbBar
                        x:Name="NavigationBreadcrumbBar"
                        MaxWidth="1000"
                        ItemClicked="NavigationBreadcrumbBar_ItemClicked"
                        ItemsSource="{x:Bind BreadCrumbs, Mode=OneWay}">
                        <BreadcrumbBar.ItemTemplate>
                            <DataTemplate x:DataType="local:Crumb">
                                <TextBlock Text="{x:Bind Label}" />
                            </DataTemplate>
                        </BreadcrumbBar.ItemTemplate>
                        <BreadcrumbBar.Resources>
                            <ResourceDictionary>
                                <x:Double x:Key="BreadcrumbBarItemThemeFontSize">28</x:Double>
                                <Thickness x:Key="BreadcrumbBarChevronPadding">7,4,8,0</Thickness>
                                <text:FontWeight x:Key="BreadcrumbBarItemFontWeight">SemiBold</text:FontWeight>
                                <x:Double x:Key="BreadcrumbBarChevronFontSize">16</x:Double>
                            </ResourceDictionary>
                        </BreadcrumbBar.Resources>
                    </BreadcrumbBar>
                </Grid>
                <Frame
                    x:Name="NavFrame"
                    Grid.Row="1"
                    Navigated="NavFrame_OnNavigated" />
            </Grid>
        </NavigationView>
    </Grid>
</winuiex:WindowEx>
