<?xml version="1.0" encoding="utf-8"?>
<Window
    x:Class="VDownload.Core.Views.BaseWindow"
    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:i="using:Microsoft.Xaml.Interactivity"
    xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
    xmlns:cb="using:MSEssentials.UI.WinUI.Behaviors"
    mc:Ignorable="d">
    <Window.SystemBackdrop>
        <MicaBackdrop Kind="Base"/>
    </Window.SystemBackdrop>
    <Grid x:Name="Root"
          Loaded="Root_Loaded">
        <Border x:Name="AppTitleBar"
                IsHitTestVisible="True"
                VerticalAlignment="Top"
                Height="40"
                Canvas.ZIndex="1" 
                Margin="55,4,0,0">
            <StackPanel Orientation="Horizontal">
                <Image HorizontalAlignment="Left" 
                       VerticalAlignment="Center"
                       Source="{StaticResource ImageLogo}"
                       Width="16" 
                       Height="16"/>
                <TextBlock Text="VDownload"
                           VerticalAlignment="Center"
                           Margin="12, 0, 0, 0"
                           Style="{StaticResource CaptionTextBlockStyle}"/>
            </StackPanel>
        </Border>
        <NavigationView IsTitleBarAutoPaddingEnabled="True"            
                        IsBackButtonVisible="Collapsed"
                        PaneDisplayMode="LeftCompact"
                        Canvas.ZIndex="0"
                        MenuItemsSource="{Binding Items}"
                        FooterMenuItemsSource="{Binding FooterItems}"
                        SelectedItem="{Binding SelectedItem}"
                        Background="Transparent">
            <i:Interaction.Behaviors>
                <cb:EventToCommandBehavior Command="{Binding NavigateCommand}" 
                               Event="ItemInvoked" 
                               PassArguments="True"/>
            </i:Interaction.Behaviors>
            <NavigationView.Resources>
                <SolidColorBrush x:Key="NavigationViewContentBackground" 
                                 Color="Transparent"/>
            </NavigationView.Resources>
            <NavigationView.MenuItemTemplate>
                <DataTemplate>
                    <NavigationViewItem Content="{Binding Name}" Tag="{Binding}">
                        <NavigationViewItem.Icon>
                            <ImageIcon Source="{Binding IconSource}"/>
                        </NavigationViewItem.Icon>
                    </NavigationViewItem>
                </DataTemplate>
            </NavigationView.MenuItemTemplate>
            <Frame Margin="0,48,0,0" 
                   CornerRadius="10" 
                   Content="{Binding CurrentViewModel, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource ViewModelToViewConverter}}">
            </Frame>
        </NavigationView>
    </Grid>
</Window>
