Files
Hua.Todo/TodoList/Views/QuickEntryWindow.xaml
T
2025-12-30 10:29:28 +08:00

85 lines
3.8 KiB
XML

<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="220" Width="400"
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="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="新建待办" FontSize="18" FontWeight="Bold" Foreground="#333"/>
<TextBox Grid.Row="1" Margin="0,15,0,15"
Text="{Binding Content, UpdateSourceTrigger=PropertyChanged}"
FontSize="14" Padding="8" 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,10,0" Foreground="#666"/>
<ComboBox ItemsSource="{Binding Source={StaticResource PriorityEnum}}"
SelectedItem="{Binding Priority}"
Width="100">
<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,10,0" Width="80" Height="32"
Background="#F0F0F0" Foreground="#333"/>
<Button Content="保存" Command="{Binding SaveCommand}" Width="80" Height="32" IsDefault="True"
Background="#007AFF" Foreground="White"/>
</StackPanel>
</Grid>
</Window>