- Category editor: icon tile per category opens an icon + color picker (no clipped mini combo boxes), placeholders explained, live preview - Header glyph removed; dialog follows the shared styles - Dialogs opened from Settings are owned by the active window (category editor could open behind the settings window) - Default language is English; German via Settings > Language Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
220 lines
15 KiB
XML
220 lines
15 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="760" SizeToContent="Height" MaxHeight="760"
|
|
WindowStartupLocation="CenterOwner" ResizeMode="NoResize" ShowInTaskbar="False"
|
|
WindowStyle="None" AllowsTransparency="True" Background="Transparent"
|
|
FontFamily="{StaticResource UiFont}" FontSize="13" Foreground="{DynamicResource TextPrimaryBrush}"
|
|
UseLayoutRounding="True"
|
|
MouseLeftButtonDown="Window_MouseLeftButtonDown" KeyDown="Window_KeyDown">
|
|
<Window.Resources>
|
|
<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="FontSize" Value="13"/>
|
|
<Setter Property="Height" Value="34"/>
|
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="TextBox">
|
|
<Border x:Name="Bd" CornerRadius="6" BorderThickness="1" Background="{TemplateBinding Background}"
|
|
BorderBrush="{DynamicResource BorderBrush}" Padding="9,0">
|
|
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center"/>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource TextTertiaryBrush}"/>
|
|
</Trigger>
|
|
<Trigger Property="IsKeyboardFocused" Value="True">
|
|
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<Style x:Key="ColHead" TargetType="TextBlock">
|
|
<Setter Property="FontSize" Value="11.5"/>
|
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
|
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}"/>
|
|
</Style>
|
|
|
|
<Style x:Key="Code" TargetType="Border">
|
|
<Setter Property="CornerRadius" Value="4"/>
|
|
<Setter Property="Padding" Value="5,0"/>
|
|
<Setter Property="Margin" Value="0,0,5,0"/>
|
|
<Setter Property="Background" Value="{DynamicResource HoverBrush}"/>
|
|
</Style>
|
|
|
|
<!-- one glyph / color choice inside the picker popup -->
|
|
<Style x:Key="PickButton" TargetType="Button">
|
|
<Setter Property="Cursor" Value="Hand"/>
|
|
<Setter Property="Margin" Value="2"/>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="Button">
|
|
<Border x:Name="Bd" Width="32" Height="32" CornerRadius="6" Background="Transparent">
|
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource HoverBrush}"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</Window.Resources>
|
|
|
|
<Border Margin="12" CornerRadius="10" Background="{DynamicResource CardBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1">
|
|
<Border.Effect>
|
|
<DropShadowEffect BlurRadius="24" ShadowDepth="6" Opacity="0.28" Direction="270" Color="Black"/>
|
|
</Border.Effect>
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition Height="*"/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
|
|
<!-- header -->
|
|
<DockPanel Margin="24,18,14,0">
|
|
<Button DockPanel.Dock="Right" Content="" Style="{StaticResource IconButton}" FontSize="10" Click="Cancel_Click" ToolTip="Esc"/>
|
|
<TextBlock Text="{Binding [Categories]}" FontSize="18" FontWeight="SemiBold" VerticalAlignment="Center"/>
|
|
</DockPanel>
|
|
|
|
<!-- explanation + column heads -->
|
|
<StackPanel Grid.Row="1" Margin="24,6,24,0">
|
|
<TextBlock Text="{Binding [CategoriesIntro]}" FontSize="12.5" TextWrapping="Wrap" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
|
<WrapPanel Margin="0,8,0,0" TextElement.FontSize="12" TextElement.Foreground="{DynamicResource TextSecondaryBrush}">
|
|
<Border Style="{StaticResource Code}"><TextBlock Text="{}{0}" FontFamily="Consolas" Foreground="{DynamicResource TextPrimaryBrush}"/></Border>
|
|
<TextBlock Text="{Binding [CatPlaceholderYears]}" Margin="0,0,16,0" VerticalAlignment="Center"/>
|
|
<Border Style="{StaticResource Code}"><TextBlock Text="{}{o}" FontFamily="Consolas" Foreground="{DynamicResource TextPrimaryBrush}"/></Border>
|
|
<TextBlock Text="{Binding [CatPlaceholderOrdinal]}" VerticalAlignment="Center"/>
|
|
</WrapPanel>
|
|
|
|
<Grid Margin="0,18,8,6">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="52"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="200"/>
|
|
<ColumnDefinition Width="190"/>
|
|
<ColumnDefinition Width="34"/>
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock Grid.Column="1" Text="{Binding [Name]}" Style="{StaticResource ColHead}"/>
|
|
<TextBlock Grid.Column="2" Text="{Binding [CatText]}" Style="{StaticResource ColHead}" Margin="10,0,0,0"/>
|
|
<TextBlock Grid.Column="3" Text="{Binding [CatExample]}" Style="{StaticResource ColHead}" Margin="14,0,0,0"/>
|
|
</Grid>
|
|
</StackPanel>
|
|
|
|
<!-- rows -->
|
|
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto" Margin="24,0,16,0" MaxHeight="420">
|
|
<ItemsControl x:Name="Rows" Margin="0,0,8,0">
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Grid Margin="0,4">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="52"/>
|
|
<ColumnDefinition Width="*"/>
|
|
<ColumnDefinition Width="200"/>
|
|
<ColumnDefinition Width="190"/>
|
|
<ColumnDefinition Width="34"/>
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!-- icon tile: click opens icon + color picker -->
|
|
<ToggleButton x:Name="Tile" Width="38" Height="34" HorizontalAlignment="Left" Cursor="Hand"
|
|
AutomationProperties.Name="{Binding DataContext[CatChangeLook], RelativeSource={RelativeSource AncestorType=Window}}"
|
|
ToolTip="{Binding DataContext[CatChangeLook], RelativeSource={RelativeSource AncestorType=Window}}">
|
|
<ToggleButton.Template>
|
|
<ControlTemplate TargetType="ToggleButton">
|
|
<Border x:Name="Bd" CornerRadius="8" BorderThickness="1" BorderBrush="Transparent"
|
|
Background="{Binding Color, Converter={StaticResource HexToBrush}, ConverterParameter=0.16}">
|
|
<TextBlock Text="{Binding Glyph}" FontFamily="{StaticResource IconFont}" FontSize="15"
|
|
HorizontalAlignment="Center" VerticalAlignment="Center"
|
|
Foreground="{Binding Color, Converter={StaticResource HexToBrush}}"/>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter TargetName="Bd" Property="BorderBrush" Value="{Binding Color, Converter={StaticResource HexToBrush}, ConverterParameter=0.6}"/>
|
|
</Trigger>
|
|
<Trigger Property="IsChecked" Value="True">
|
|
<Setter TargetName="Bd" Property="BorderBrush" Value="{Binding Color, Converter={StaticResource HexToBrush}}"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</ToggleButton.Template>
|
|
</ToggleButton>
|
|
<Popup IsOpen="{Binding IsChecked, ElementName=Tile, Mode=TwoWay}" PlacementTarget="{Binding ElementName=Tile}" Placement="Bottom"
|
|
StaysOpen="False" AllowsTransparency="True" PopupAnimation="Fade" VerticalOffset="4">
|
|
<Border Background="{DynamicResource MenuBackgroundBrush}" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
|
|
CornerRadius="8" Padding="10" Margin="6,0,6,10" Width="244">
|
|
<Border.Effect>
|
|
<DropShadowEffect BlurRadius="14" ShadowDepth="3" Opacity="0.22" Color="Black"/>
|
|
</Border.Effect>
|
|
<StackPanel>
|
|
<TextBlock Text="{Binding DataContext[CatIcon], RelativeSource={RelativeSource AncestorType=Window}}"
|
|
FontSize="11.5" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondaryBrush}" Margin="2,0,0,4"/>
|
|
<ItemsControl ItemsSource="{Binding Glyphs, RelativeSource={RelativeSource AncestorType=Window}}">
|
|
<ItemsControl.ItemsPanel><ItemsPanelTemplate><WrapPanel/></ItemsPanelTemplate></ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Button Style="{StaticResource PickButton}" Click="PickGlyph_Click" Tag="{Binding}">
|
|
<TextBlock Text="{Binding}" FontFamily="{StaticResource IconFont}" FontSize="15"
|
|
Foreground="{DynamicResource TextPrimaryBrush}"/>
|
|
</Button>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
<TextBlock Text="{Binding DataContext[Color], RelativeSource={RelativeSource AncestorType=Window}}"
|
|
FontSize="11.5" FontWeight="SemiBold" Foreground="{DynamicResource TextSecondaryBrush}" Margin="2,10,0,4"/>
|
|
<ItemsControl ItemsSource="{Binding Palette, RelativeSource={RelativeSource AncestorType=Window}}">
|
|
<ItemsControl.ItemsPanel><ItemsPanelTemplate><WrapPanel/></ItemsPanelTemplate></ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Button Style="{StaticResource PickButton}" Click="PickColor_Click" Tag="{Binding}">
|
|
<Ellipse Width="18" Height="18" Fill="{Binding Converter={StaticResource HexToBrush}}"/>
|
|
</Button>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</StackPanel>
|
|
</Border>
|
|
</Popup>
|
|
|
|
<TextBox Grid.Column="1" Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}"/>
|
|
<TextBox Grid.Column="2" Text="{Binding Format, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}" Margin="10,0,0,0"/>
|
|
|
|
<TextBlock Grid.Column="3" Margin="14,0,0,0" VerticalAlignment="Center" FontSize="12.5" TextTrimming="CharacterEllipsis"
|
|
Foreground="{DynamicResource TextSecondaryBrush}" Loaded="Example_Loaded" Tag="{Binding}"/>
|
|
|
|
<Button Grid.Column="4" Content="" Style="{StaticResource IconButton}" HorizontalAlignment="Right"
|
|
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="24,16,24,20">
|
|
<Button DockPanel.Dock="Left" Style="{StaticResource SubtleButton}" Click="Add_Click">
|
|
<StackPanel Orientation="Horizontal">
|
|
<TextBlock Text="" FontFamily="{StaticResource IconFont}" FontSize="11" VerticalAlignment="Center" Margin="0,1,8,0"/>
|
|
<TextBlock Text="{Binding [AddCategoryShort]}"/>
|
|
</StackPanel>
|
|
</Button>
|
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
|
<Button Content="{Binding [Cancel]}" Style="{StaticResource SubtleButton}" Click="Cancel_Click"/>
|
|
<Button Content="{Binding [Save]}" Style="{StaticResource PrimaryButton}" Click="Save_Click" IsDefault="True" Margin="8,0,0,0"/>
|
|
</StackPanel>
|
|
</DockPanel>
|
|
</Grid>
|
|
</Border>
|
|
</Window>
|