<Window x:Class="AutoDarkModeApp.MainWindowMwpf"
        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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:AutoDarkModeApp"
        xmlns:ui="http://schemas.modernwpf.com/2019"
        xmlns:p="clr-namespace:AutoDarkModeLib.Properties;assembly=AutoDarkModeLib"
        mc:Ignorable="d"
        Title="{x:Static p:Resources.Title}"
        MinHeight="600"
        MinWidth="870"
        Height="760"
        Width="1050"
        ResizeMode="CanResize"
        Closed="Window_Closed"
        Closing="Window_Closing"
        SourceInitialized="Window_OnSourceInitialized"
        ContentRendered="Window_ContentRendered"
        ui:WindowHelper.UseModernWindowStyle="True"
        ui:TitleBar.ExtendViewIntoTitleBar="True"
        ui:ThemeManager.IsThemeAware="True">

    <Grid x:Name="mainWin">

        <!-- Grid Layout -->
        <Grid.RowDefinitions>
            <RowDefinition Height="32" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="320" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="138" />
            </Grid.ColumnDefinitions>

            <StackPanel Grid.Column="0"
                       Name="TopBarTitle"
                       Background="{DynamicResource AltHighClone}"
                       Width="Auto"
                       Height="Auto" />
            <StackPanel Grid.Column="1"
                       Name="TopBarHeader"
                       Background="{DynamicResource AltHighClone}"
                       Width="Auto"
                       Height="Auto" />
            <StackPanel Grid.Column="2"
                       Name="TopBarCloseButtonsOpaque"
                       Background="{DynamicResource AltHighClone}"
                       Width="Auto"
                       Height="Auto" />
            <Border BorderThickness="5"
                    Name="TopBarCloseButtonsForMica"
                    BorderBrush="{DynamicResource AltHighClone}"
                    CornerRadius="0,0,0,7"
                    Background="{DynamicResource AltHighClone}"
                    Grid.Column="2">
            </Border>

            <!-- Title Bar -->
            <TextBlock HorizontalAlignment="Left"
                       x:Name="WindowTitle"
                       Margin="10,0,0,0"
                       TextWrapping="Wrap"
                       Text="{x:Static p:Resources.Title}"
                       VerticalAlignment="Center"
                       Grid.Column="0"
                       Grid.Row="0" />
        </Grid>


        <!-- Navbar -->
        <ui:NavigationView x:Name="NavBar"
                           Grid.Row="1"
                           IsBackButtonVisible="Collapsed"
                           IsBackEnabled="False"
                           IsPaneOpen="True"
                           PaneDisplayMode="Left"
                           OpenPaneLength="320"
                           IsPaneToggleButtonVisible="False"
                           IsSettingsVisible="False"
                           AlwaysShowHeader="True"
                           Height="Auto"
                           Width="Auto"
                           HorizontalAlignment="Stretch"
                           HorizontalContentAlignment="Stretch"
                           VerticalAlignment="Stretch"
                           VerticalContentAlignment="Stretch"
                           SelectionChanged="NavBar_SelectionChanged"
                           Loaded="NavBar_Loaded">

            <ui:NavigationView.MenuItems>
                <ui:NavigationViewItemHeader Content="{x:Static p:Resources.NavbarTitle}"
                                             Height="60" />

                <ui:NavigationViewItem Tag="time"
                                       Content="{x:Static p:Resources.NavbarTime}"
                                       Height="50">
                    <ui:NavigationViewItem.Icon>
                        <ui:FontIcon FontFamily="Segoe Fluent Icons"
                                     Glyph="&#xE823;" />
                    </ui:NavigationViewItem.Icon>
                </ui:NavigationViewItem>

                <ui:NavigationViewItem Tag="modes"
                                       Content="{x:Static p:Resources.NavbarSwitchModes}"
                                       Height="50">
                    <ui:NavigationViewItem.Icon>
                        <ui:FontIcon FontFamily="Segoe Fluent Icons"
                                     Glyph="&#xE945;" />
                    </ui:NavigationViewItem.Icon>
                </ui:NavigationViewItem>

                <ui:NavigationViewItem Tag="apps"
                                       Content="{x:Static p:Resources.NavbarApps}"
                                       Height="50">
                    <ui:NavigationViewItem.Icon>
                        <ui:FontIcon FontFamily="Segoe Fluent Icons"
                                     Glyph="&#xE71D;" />
                    </ui:NavigationViewItem.Icon>
                </ui:NavigationViewItem>

                <ui:NavigationViewItem Tag="wallpaper"
                                       Content="{x:Static p:Resources.NavbarPersonalization}"
                                       Height="50">
                    <ui:NavigationViewItem.Icon>
                        <ui:FontIcon FontFamily="Segoe Fluent Icons"
                                     Glyph="&#xE771;" />
                    </ui:NavigationViewItem.Icon>
                </ui:NavigationViewItem>

                <ui:NavigationViewItem Tag="scripts"
                                       Content="{x:Static p:Resources.NavbarScripts}"
                                       Height="50">
                    <ui:NavigationViewItem.Icon>
                        <ui:FontIcon FontFamily="Segoe Fluent Icons"
                                     Glyph="&#xF000;" />
                    </ui:NavigationViewItem.Icon>
                </ui:NavigationViewItem>

                <ui:NavigationViewItem Tag="settings"
                                       Content="{x:Static p:Resources.NavbarSettings}"
                                       Height="50">
                    <ui:NavigationViewItem.Icon>
                        <ui:FontIcon FontFamily="Segoe Fluent Icons"
                                     Glyph="&#xE713;" />
                    </ui:NavigationViewItem.Icon>
                </ui:NavigationViewItem>
            </ui:NavigationView.MenuItems>

            <ui:NavigationView.FooterMenuItems>
                <ui:NavigationViewItem Tag="donation"
                                       Content="{x:Static p:Resources.NavbarDonation}"
                                       Height="50">
                    <ui:NavigationViewItem.Icon>
                        <ui:FontIcon FontFamily="Segoe Fluent Icons"
                                     Glyph="&#xEB51;" />
                    </ui:NavigationViewItem.Icon>
                </ui:NavigationViewItem>

                <ui:NavigationViewItem Tag="about"
                                       Content="{x:Static p:Resources.NavbarAbout}"
                                       Height="50">
                    <ui:NavigationViewItem.Icon>
                        <ui:FontIcon FontFamily="Segoe Fluent Icons"
                                     Glyph="&#xE946;" />
                    </ui:NavigationViewItem.Icon>
                </ui:NavigationViewItem>
            </ui:NavigationView.FooterMenuItems>

            <ui:NavigationView.PaneFooter>
                <ui:NavigationViewItem Tag="help"
                                       Content="{x:Static p:Resources.tbHelp}"
                                       Height="50"
                                       MouseLeftButtonUp="HelpMenuItem_Clicked">
                    <ui:NavigationViewItem.Icon>
                        <ui:FontIcon FontFamily="Segoe Fluent Icons"
                                     Glyph="&#xE897;" />
                    </ui:NavigationViewItem.Icon>
                </ui:NavigationViewItem>
            </ui:NavigationView.PaneFooter>

            <!-- Content of Navbar, mainly the Frame which contains the Pages -->
            <ScrollViewer PanningMode="Both"
                          x:Name="ScrollViewerNavbar">
                <ui:Frame Content=""
                          Name="FrameNavbar"
                          Margin="0,0,0,0"
                          Height="Auto"
                          Width="Auto"
                          NavigationUIVisibility="Hidden"
                          Focusable="False"
                          Navigating="FrameNavbar_Navigating" />
            </ScrollViewer>

            <!-- Custom Navbar Styles -->
            <ui:NavigationView.Resources>
                <SolidColorBrush x:Key="NavigationViewTopPaneBackground"
                                 Color="{DynamicResource NavbarBackground}" />
                <SolidColorBrush x:Key="NavigationViewDefaultPaneBackground"
                                 Color="{DynamicResource NavbarBackground}" />
                <SolidColorBrush x:Key="NavigationViewExpandedPaneBackground"
                                 Color="{DynamicResource NavbarBackground}" />

                <!--
                <SolidColorBrush x:Key="NavigationViewItemForegroundSelected" Color="{DynamicResource SystemAccentColor}"/>
                <SolidColorBrush x:Key="NavigationViewItemForegroundSelectedPointerOver" Color="{DynamicResource SystemAccentColor}"/>
                <SolidColorBrush x:Key="NavigationViewItemForegroundSelectedPressed" Color="{DynamicResource SystemAccentColor}"/>
                -->
            </ui:NavigationView.Resources>

        </ui:NavigationView>
    </Grid>
</Window>