Files
ReminderOrganizer/CategoryWindow.xaml
Michi 00e9990feb Anniversary categories (wedding, jubilee, own) and month grouping
- Birthday becomes "anniversary" with a category: birthday, wedding
  anniversary (with Silver/Gold/... names), jubilee, memorial day
- Own categories: Settings > Categories (icon, color, text with {0}/{o})
- Sidebar "Categories" lists anniversaries across folders with counts
- Group by month (any view), groups fold with a click
- Folders named Hochzeit/Wedding migrate yearly tasks once
- Old files keep working (JSON "IsBirthday" maps to IsAnniversary)
- 74 tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:06:19 +01:00

169 lines
10 KiB
XML

<Window x:Class="ReminderOrganizer.CategoryWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="{Binding [Categories]}"
Width="780" SizeToContent="Height" MaxHeight="720"
WindowStartupLocation="CenterOwner"
ResizeMode="NoResize"
ShowInTaskbar="False"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent"
MouseLeftButtonDown="Window_MouseLeftButtonDown">
<Window.Resources>
<SolidColorBrush x:Key="PrimaryBrush" Color="#6366F1"/>
<SolidColorBrush x:Key="DangerBrush" Color="#EF4444"/>
<SolidColorBrush x:Key="TextPrimaryBrush" Color="#1E293B"/>
<SolidColorBrush x:Key="TextSecondaryBrush" Color="#64748B"/>
<SolidColorBrush x:Key="BorderBrush" Color="#CBD5E1"/>
<SolidColorBrush x:Key="CardBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="InputBackgroundBrush" Color="#F1F5F9"/>
<SolidColorBrush x:Key="HoverBrush" Color="#E2E8F0"/>
<Style x:Key="Input" TargetType="TextBox">
<Setter Property="Background" Value="{DynamicResource InputBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
<Setter Property="CaretBrush" Value="{DynamicResource TextPrimaryBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="8,5"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
<Style x:Key="DialogButton" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="18,8"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bd" Property="Opacity" Value="0.85"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="bd" Property="Opacity" Value="0.35"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Border CornerRadius="12" Background="{DynamicResource CardBrush}" Margin="8">
<Border.Effect>
<DropShadowEffect BlurRadius="20" ShadowDepth="5" Opacity="0.25" Direction="270" Color="Black"/>
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Header -->
<Border Background="{DynamicResource PrimaryBrush}" CornerRadius="12,12,0,0" Padding="16,10">
<Grid>
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xE8EC;" FontFamily="Segoe MDL2 Assets" FontSize="15" Foreground="White" VerticalAlignment="Center"/>
<TextBlock Text="{Binding [Categories]}" FontSize="14" FontWeight="SemiBold" Foreground="White" VerticalAlignment="Center" Margin="10,0,0,0"/>
</StackPanel>
<Button Content="&#xE8BB;" FontFamily="Segoe MDL2 Assets" FontSize="10" HorizontalAlignment="Right" Foreground="White"
Background="Transparent" BorderThickness="0" Width="28" Height="28" Cursor="Hand" Click="Cancel_Click" IsCancel="True"/>
</Grid>
</Border>
<!-- Hint + column titles -->
<StackPanel Grid.Row="1" Margin="18,14,18,4">
<TextBlock Text="{Binding [CategoriesHint]}" FontSize="12" TextWrapping="Wrap" Foreground="{DynamicResource TextSecondaryBrush}"/>
<Grid Margin="0,12,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="56"/>
<ColumnDefinition Width="56"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="170"/>
<ColumnDefinition Width="190"/>
<ColumnDefinition Width="34"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding [CatIcon]}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondaryBrush}"/>
<TextBlock Grid.Column="1" Text="{Binding [Color]}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondaryBrush}"/>
<TextBlock Grid.Column="2" Text="{Binding [Name]}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondaryBrush}"/>
<TextBlock Grid.Column="3" Text="{Binding [CatText]}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondaryBrush}" Margin="8,0,0,0"/>
<TextBlock Grid.Column="4" Text="{Binding [CatExample]}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondaryBrush}" Margin="8,0,0,0"/>
</Grid>
</StackPanel>
<!-- Rows -->
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto" Margin="18,0,10,0" MaxHeight="440">
<ItemsControl x:Name="Rows" Margin="0,0,8,0">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="0,4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="56"/>
<ColumnDefinition Width="56"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="170"/>
<ColumnDefinition Width="190"/>
<ColumnDefinition Width="34"/>
</Grid.ColumnDefinitions>
<ComboBox Grid.Column="0" Width="50" Height="30" HorizontalAlignment="Left"
ItemsSource="{Binding Glyphs, RelativeSource={RelativeSource AncestorType=Window}}"
SelectedItem="{Binding Glyph}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontFamily="Segoe MDL2 Assets" FontSize="14"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<ComboBox Grid.Column="1" Width="50" Height="30" HorizontalAlignment="Left"
ItemsSource="{Binding Palette, RelativeSource={RelativeSource AncestorType=Window}}"
SelectedItem="{Binding Color}">
<ComboBox.ItemTemplate>
<DataTemplate>
<Ellipse Width="14" Height="14" Fill="{Binding Converter={StaticResource HexToBrush}}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<TextBox Grid.Column="2" Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}"/>
<TextBox Grid.Column="3" Text="{Binding Format, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}" Margin="8,0,0,0"/>
<TextBlock Grid.Column="4" Margin="8,0,0,0" VerticalAlignment="Center" FontSize="11" TextTrimming="CharacterEllipsis"
Foreground="{Binding Color, Converter={StaticResource HexToBrush}}"
Loaded="Example_Loaded" Tag="{Binding}"/>
<Button Grid.Column="5" Content="&#xE74D;" FontFamily="Segoe MDL2 Assets" FontSize="12" Width="28" Height="28"
Background="Transparent" BorderThickness="0" Cursor="Hand" Foreground="{DynamicResource DangerBrush}"
Click="Delete_Click" Tag="{Binding}" ToolTip="{Binding DataContext[Delete], RelativeSource={RelativeSource AncestorType=Window}}"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<!-- Buttons -->
<DockPanel Grid.Row="3" Margin="18,12,18,18">
<Button DockPanel.Dock="Left" Content="{Binding [AddCategory]}" Style="{StaticResource DialogButton}" Click="Add_Click"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="{Binding [Cancel]}" Style="{StaticResource DialogButton}" Click="Cancel_Click"/>
<Button Content="{Binding [Save]}" Style="{StaticResource DialogButton}" Click="Save_Click" IsDefault="True"
Background="{DynamicResource PrimaryBrush}" Foreground="White" BorderThickness="0" Margin="8,0,0,0"/>
</StackPanel>
</DockPanel>
</Grid>
</Border>
</Window>