<Window x:Class="TodoList.Views.QuickEntryWindow"
        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:TodoList.Views"
        xmlns:models="clr-namespace:TodoList.Models"
        xmlns:converters="clr-namespace:TodoList.Converters"
        mc:Ignorable="d"
        Title="新建待办" Height="180" Width="320"
        WindowStyle="None" ResizeMode="NoResize"
        WindowStartupLocation="CenterScreen"
        Topmost="True"
        Background="White"
        BorderBrush="#007AFF" BorderThickness="1">
    
    <Window.Effect>
        <DropShadowEffect BlurRadius="20" ShadowDepth="5" Opacity="0.3"/>
    </Window.Effect>

    <Window.Resources>
        <ObjectDataProvider x:Key="PriorityEnum" MethodName="GetValues"
                            ObjectType="{x:Type sys:Enum}"
                            xmlns:sys="clr-namespace:System;assembly=mscorlib">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="models:TodoPriority"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
        <converters:EnumDescriptionConverter x:Key="EnumDescConverter"/>

        <Style TargetType="Button">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border Background="{TemplateBinding Background}" CornerRadius="5" BorderThickness="0">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>

    <Grid Margin="15">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <TextBlock Text="新建待办" FontSize="15" FontWeight="Bold" Foreground="#333"/>

        <TextBox Grid.Row="1" Margin="0,12,0,12" 
                 Text="{Binding Content, UpdateSourceTrigger=PropertyChanged}"
                 FontSize="12" Padding="6" BorderThickness="0,0,0,1"
                 x:Name="InputBox">
            <TextBox.InputBindings>
                <KeyBinding Key="Enter" Command="{Binding SaveCommand}"/>
                <KeyBinding Key="Esc" Command="{Binding CancelCommand}"/>
            </TextBox.InputBindings>
        </TextBox>

        <StackPanel Grid.Row="2" Orientation="Horizontal" VerticalAlignment="Top">
            <TextBlock Text="优先级:" VerticalAlignment="Center" Margin="0,0,8,0" Foreground="#666" FontSize="11"/>
            <ComboBox ItemsSource="{Binding Source={StaticResource PriorityEnum}}"
                      SelectedItem="{Binding Priority}"
                      Width="80" FontSize="11">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Converter={StaticResource EnumDescConverter}}"/>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
        </StackPanel>

        <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Content="取消" Command="{Binding CancelCommand}" Margin="0,0,8,0" Width="65" Height="26"
                    Background="#F0F0F0" Foreground="#333" FontSize="11"/>
            <Button Content="保存" Command="{Binding SaveCommand}" Width="65" Height="26" IsDefault="True"
                    Background="#007AFF" Foreground="#White" FontSize="11"/>
        </StackPanel>
    </Grid>
</Window>
