<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="using:AvaloniaSideBarEx.ViewModels"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
        x:Class="AvaloniaSideBarEx.Views.MainWindow"
        x:DataType="vm:MainWindowViewModel"
        FontFamily="Noto Sans TC"
        Icon="/Assets/avalonia-logo.ico"
        Title="AvaloniaSideBarEx">
    
    <!-- 主視窗框架區塊 -->
    <Grid RowDefinitions="Auto, *">
        
        <!-- Header Menu-->
        <Menu Background="#ECF0F1" Grid.Row="0">
            <MenuItem Header="☰" Command="{Binding ToggleSidebarCommand}"/>
            <MenuItem Header="關於">
                <MenuItem Header="關於應用" />
            </MenuItem>
        </Menu>
        
        <!--側邊欄-->
        <SplitView Grid.Row="1"
                   DisplayMode="Overlay" 
                   OpenPaneLength="200"
                   IsPaneOpen="{Binding IsSidebarOpen, Mode=TwoWay}">
            <!--側邊欄內容-->
            <SplitView.Pane>
                <Border BorderBrush="#BDC3C7"         
                        BorderThickness="0, 0, 1, 0">
                    <StackPanel Background="#ECF0F1"> 
                        <TextBlock Text="導航選單" 
                                   FontSize="16" 
                                   HorizontalAlignment="Center"
                                   Margin="15, 20, 15, 10"/>
                        <ListBox Background="Transparent" 
                                 BorderThickness="0" 
                                 Padding="0"
                                 SelectionMode="Single"
                                 ItemsSource="{Binding MenuItems}"
                                 SelectedItem="{Binding SelectedMenuItem, Mode=TwoWay}"
                                 SelectedIndex="0">

                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Label}" 
                                               Margin="3" 
                                               HorizontalAlignment="Center"/>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </StackPanel>
                </Border>
            </SplitView.Pane>
            
            
            <SplitView.Content>
                <Grid RowDefinitions="*, Auto" ColumnDefinitions="*, *, *" Background="#ECF0F1">
                    <!--主內容區塊-->
                    <ContentControl Grid.Row="0" 
                                    Grid.ColumnSpan="3"
                                    Content="{Binding CurrentPage}" 
                                    
                                    VerticalAlignment="Stretch"
                                    HorizontalAlignment="Stretch"/>
                    <!--Footer-->
                    <Border Grid.Column="0" 
                            Grid.Row="1" 
                            Grid.ColumnSpan="3" 
                            BorderBrush="#BDC3C7"     
                            BorderThickness="0, 1, 0, 0"
                            Padding="10">
                        <TextBlock Text="Xian - 版權所有 © 2025" 
                                   HorizontalAlignment="Right" 
                                   FontSize="12"/>
                    </Border>
                </Grid>
            </SplitView.Content>
            
        </SplitView>
        
    </Grid>
</Window>
