Phase 3 缺陷修复 + 分类管理功能 + ComboBox 主题适配

缺陷修复: 日志自动滚动、StaticResource 顺序修复、ContextMenu PlacementTarget 绑定、PATH 命令支持、异常全量捕获、RefreshData 状态保留、全局崩溃日志

分类管理: 添加/编辑/删除分类,删除时工具移入全部,CategoryEditViewModel/Window

UI 修复: ComboBox 自定义模板,暗色模式弹出层/下拉项主题配色,文本绑定修复
This commit is contained in:
2026-05-09 22:53:19 +08:00
parent 71be5da54b
commit dc94d17d99
8 changed files with 424 additions and 5 deletions

View File

@@ -7,6 +7,93 @@
ResizeMode="NoResize"
Background="{DynamicResource Theme.Background}">
<Window.Resources>
<!-- ComboBox 下拉项统一样式 -->
<Style TargetType="ComboBoxItem">
<Setter Property="Background" Value="{DynamicResource Theme.InputBackground}"/>
<Setter Property="Foreground" Value="{DynamicResource Theme.Foreground}"/>
<Setter Property="Padding" Value="6,3"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
<Border x:Name="Border"
Background="{TemplateBinding Background}"
Padding="{TemplateBinding Padding}">
<ContentPresenter/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsHighlighted" Value="True">
<Setter TargetName="Border" Property="Background" Value="{DynamicResource Theme.Accent}"/>
<Setter Property="Foreground" Value="{DynamicResource Theme.ButtonForeground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- ComboBox 整体样式(覆盖弹出层背景) -->
<Style TargetType="ComboBox">
<Setter Property="Background" Value="{DynamicResource Theme.InputBackground}"/>
<Setter Property="Foreground" Value="{DynamicResource Theme.Foreground}"/>
<Setter Property="BorderBrush" Value="{DynamicResource Theme.InputBorder}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<ToggleButton x:Name="ToggleButton"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Foreground="{TemplateBinding Foreground}"
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
Padding="{TemplateBinding Padding}">
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}">
<Grid>
<TextBlock Text="{Binding Text, RelativeSource={RelativeSource AncestorType=ComboBox}}"
Foreground="{TemplateBinding Foreground}"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="6,0,0,0"/>
<Path x:Name="Arrow" Data="M0,0 L4,4 8,0" Stroke="{TemplateBinding Foreground}"
StrokeThickness="1.5" HorizontalAlignment="Right" Width="8"
VerticalAlignment="Center" Margin="0,0,6,0"/>
</Grid>
</Border>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<Popup x:Name="Popup"
IsOpen="{TemplateBinding IsDropDownOpen}"
Placement="Bottom"
AllowsTransparency="True"
Focusable="False"
PopupAnimation="Slide">
<Grid MaxHeight="{TemplateBinding MaxDropDownHeight}"
MinWidth="{TemplateBinding ActualWidth}">
<Border Background="{DynamicResource Theme.InputBackground}"
BorderBrush="{DynamicResource Theme.InputBorder}"
BorderThickness="1"
SnapsToDevicePixels="True">
<ScrollViewer>
<ItemsPresenter/>
</ScrollViewer>
</Border>
</Grid>
</Popup>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
@@ -73,9 +160,6 @@
ItemsSource="{Binding Categories}"
SelectedItem="{Binding SelectedCategory}"
DisplayMemberPath="Name"
Background="{DynamicResource Theme.InputBackground}"
Foreground="{DynamicResource Theme.Foreground}"
BorderBrush="{DynamicResource Theme.InputBorder}"
Height="30" Margin="0,0,0,12" Padding="4,0"/>
<!-- 全局快捷键 -->