Phase 7: 自定义图标系统 + 组合嵌套 + 删除功能 + UI 优化
- 安装 FontAwesome.Sharp v6.6.0,新增 Helpers/IconProvider.cs(190+ 图标,11 分类) - ToolEditWindow/GroupEditWindow: 添加图标选择 ComboBox,按分类分组,带图标预览 - MainWindow 卡片模板: 使用 fa:IconBlock 渲染图标,IconCode 为空时回退首字母 - 组合角标从 emoji 改为 FontAwesome Cubes 图标,放置于卡片右上角 - ComboBox 样式修复: TextBlock→ContentPresenter,支持 ItemTemplate+DisplayMemberPath - ComboBox 滚轮修复: CanContentScroll=False 解决分组模式下滑轮跳组问题 - 编辑弹窗: 所有输入控件添加 VerticalContentAlignment=Center - 组合可包含其他组合: GetAncestorIds 递归排除自身及祖先防止循环引用 - ProcessExecutionService: 支持嵌套组合递归执行,visited 集合防死循环 - MainWindow 右键菜单新增删除功能,工具和组合均支持 - 移除侧边栏顶部个人工具箱标题文字 - 更新测试: 适配组合嵌套逻辑,新增祖先排除测试 (83/83 通过)
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
Background="{DynamicResource Theme.InputBackground}"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
BorderBrush="{DynamicResource Theme.InputBorder}"
|
||||
VerticalContentAlignment="Center"
|
||||
Height="30" Margin="0,0,0,16" Padding="6,0"/>
|
||||
|
||||
<Border Grid.Row="2" Grid.ColumnSpan="2"
|
||||
|
||||
@@ -1,17 +1,108 @@
|
||||
<Window x:Class="PersonalToolBox.Views.GroupEditWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="{Binding WindowTitle}" Height="500" Width="500"
|
||||
xmlns:fa="http://schemas.awesome.incremented/wpf/xaml/fontawesome.sharp"
|
||||
Title="{Binding WindowTitle}" Height="580" Width="520"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
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 VerticalAlignment="Center"/>
|
||||
</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 整体样式(兼容 DisplayMemberPath 和 ItemTemplate) -->
|
||||
<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="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBox">
|
||||
<Grid>
|
||||
<ToggleButton x:Name="ToggleButton"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
ClickMode="Press">
|
||||
<ToggleButton.Template>
|
||||
<ControlTemplate TargetType="ToggleButton">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<Grid>
|
||||
<ContentPresenter x:Name="ContentSite"
|
||||
Content="{Binding SelectionBoxItem, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"
|
||||
ContentTemplate="{Binding SelectionBoxItemTemplate, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"
|
||||
ContentStringFormat="{Binding SelectionBoxItemStringFormat, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"
|
||||
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 CanContentScroll="False">
|
||||
<ItemsPresenter/>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid Margin="16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
@@ -22,41 +113,84 @@
|
||||
|
||||
<!-- 组合名称 -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
Text="名称:" Foreground="{DynamicResource Theme.Foreground}"
|
||||
Text="名称:"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
VerticalAlignment="Center" Margin="0,0,0,10"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1"
|
||||
Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}"
|
||||
Background="{DynamicResource Theme.InputBackground}"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
BorderBrush="{DynamicResource Theme.InputBorder}"
|
||||
VerticalContentAlignment="Center"
|
||||
Height="28" Margin="0,0,0,10" Padding="6,0"/>
|
||||
|
||||
<!-- 所属分类 -->
|
||||
<!-- 图标 -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
Text="分类:" Foreground="{DynamicResource Theme.Foreground}"
|
||||
Text="图标:"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
VerticalAlignment="Center" Margin="0,0,0,10"/>
|
||||
<ComboBox Grid.Row="1" Grid.Column="1"
|
||||
ItemsSource="{Binding Categories}"
|
||||
SelectedItem="{Binding SelectedCategory}"
|
||||
DisplayMemberPath="Name"
|
||||
Height="28" Margin="0,0,0,10" Padding="4,0"/>
|
||||
ItemsSource="{Binding AvailableIconsView}"
|
||||
SelectedItem="{Binding SelectedIcon}"
|
||||
Height="28" Margin="0,0,0,10" Padding="4,0">
|
||||
<ComboBox.GroupStyle>
|
||||
<GroupStyle>
|
||||
<GroupStyle.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{DynamicResource Theme.Accent}"
|
||||
FontSize="11"
|
||||
Margin="10,6,0,2"/>
|
||||
</DataTemplate>
|
||||
</GroupStyle.HeaderTemplate>
|
||||
</GroupStyle>
|
||||
</ComboBox.GroupStyle>
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<fa:IconBlock Icon="{Binding Icon}"
|
||||
FontSize="16" Width="28"
|
||||
Foreground="{DynamicResource Theme.Accent}"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding Name}"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
VerticalAlignment="Center" Margin="8,0,0,0"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<!-- 所属分类 -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
Text="分类:"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
VerticalAlignment="Center" Margin="0,0,0,10"/>
|
||||
<ComboBox Grid.Row="2" Grid.Column="1"
|
||||
ItemsSource="{Binding Categories}"
|
||||
SelectedItem="{Binding SelectedCategory}"
|
||||
DisplayMemberPath="Name"
|
||||
Height="28" Margin="0,0,0,10" Padding="4,0"/>
|
||||
|
||||
<!-- 快捷键 -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
Text="快捷键:" Foreground="{DynamicResource Theme.Foreground}"
|
||||
<TextBlock Grid.Row="3" Grid.Column="0"
|
||||
Text="快捷键:"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
VerticalAlignment="Center" Margin="0,0,0,10"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1"
|
||||
<TextBox Grid.Row="3" Grid.Column="1"
|
||||
Text="{Binding HotKey, UpdateSourceTrigger=PropertyChanged}"
|
||||
Background="{DynamicResource Theme.InputBackground}"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
BorderBrush="{DynamicResource Theme.InputBorder}"
|
||||
VerticalContentAlignment="Center"
|
||||
Height="28" Margin="0,0,0,10" Padding="6,0"/>
|
||||
|
||||
<!-- 子工具选择 -->
|
||||
<TextBlock Grid.Row="3" Grid.Column="0"
|
||||
Text="包含工具:" Foreground="{DynamicResource Theme.Foreground}"
|
||||
<TextBlock Grid.Row="4" Grid.Column="0"
|
||||
Text="包含工具:"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
VerticalAlignment="Top" Margin="0,4,0,0"/>
|
||||
<Border Grid.Row="3" Grid.Column="1"
|
||||
<Border Grid.Row="4" Grid.Column="1"
|
||||
Background="{DynamicResource Theme.InputBackground}"
|
||||
BorderBrush="{DynamicResource Theme.InputBorder}"
|
||||
BorderThickness="1"
|
||||
@@ -68,16 +202,35 @@
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding IsSelected}"
|
||||
Content="{Binding Tool.Name}"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
Margin="4,2"/>
|
||||
Margin="4,2">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Tool.Name}"
|
||||
Foreground="{DynamicResource Theme.Foreground}"/>
|
||||
<TextBlock Text=" [组合]"
|
||||
Foreground="{DynamicResource Theme.Accent}"
|
||||
FontSize="10"
|
||||
VerticalAlignment="Center"
|
||||
Margin="2,0,0,0">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Tool.IsGroup}" Value="True">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</CheckBox>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Border>
|
||||
|
||||
<!-- 按钮 -->
|
||||
<StackPanel Grid.Row="5" Grid.Column="1"
|
||||
<StackPanel Grid.Row="6" Grid.Column="1"
|
||||
Orientation="Horizontal" HorizontalAlignment="Right"
|
||||
Margin="0,10,0,0">
|
||||
<Button Content="保存"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
xmlns:local="clr-namespace:PersonalToolBox.Views"
|
||||
xmlns:vm="clr-namespace:PersonalToolBox.ViewModels"
|
||||
xmlns:models="clr-namespace:PersonalToolBox.Models"
|
||||
xmlns:fa="http://schemas.awesome.incremented/wpf/xaml/fontawesome.sharp"
|
||||
mc:Ignorable="d"
|
||||
Title="个人工具箱" Height="650" Width="960"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
@@ -15,6 +16,7 @@
|
||||
<!-- 值转换器(必须定义在 DataTemplate 之前,确保 StaticResource 能解析) -->
|
||||
<local:BoolToOpacityConverter x:Key="BoolToOpacityConverter"/>
|
||||
<local:FirstCharConverter x:Key="FirstCharConverter"/>
|
||||
<local:StringToIconCharConverter x:Key="StringToIconCharConverter"/>
|
||||
|
||||
<!-- 工具卡片模板 -->
|
||||
<DataTemplate x:Key="ToolCardTemplate" DataType="{x:Type models:ToolItem}">
|
||||
@@ -66,24 +68,41 @@
|
||||
</Style>
|
||||
</MenuItem.Style>
|
||||
</MenuItem>
|
||||
<Separator/>
|
||||
<MenuItem Header="删除"
|
||||
Command="{Binding PlacementTarget.Tag.DeleteToolCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
|
||||
CommandParameter="{Binding}"/>
|
||||
</ContextMenu>
|
||||
</Border.ContextMenu>
|
||||
<Grid>
|
||||
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
|
||||
<Grid HorizontalAlignment="Center" Margin="0,0,0,4">
|
||||
<TextBlock Text="{Binding Name, Converter={StaticResource FirstCharConverter}}"
|
||||
FontSize="28"
|
||||
<!-- FontAwesome 图标(IconCode 有值时显示) -->
|
||||
<fa:IconBlock Icon="{Binding IconCode, Converter={StaticResource StringToIconCharConverter}}"
|
||||
FontSize="28"
|
||||
Foreground="{DynamicResource Theme.Accent}"
|
||||
HorizontalAlignment="Center">
|
||||
<fa:IconBlock.Style>
|
||||
<Style TargetType="fa:IconBlock">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IconCode}" Value="">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</fa:IconBlock.Style>
|
||||
</fa:IconBlock>
|
||||
<!-- 首字母回退(IconCode 为空时显示) -->
|
||||
<TextBlock FontSize="28"
|
||||
Foreground="{DynamicResource Theme.Accent}"
|
||||
HorizontalAlignment="Center"/>
|
||||
<!-- 组合角标 -->
|
||||
<TextBlock Text="📦" FontSize="11"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Margin="0,0,-12,-4">
|
||||
HorizontalAlignment="Center">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="TextBlock">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
<Setter Property="Text" Value="{Binding Name, Converter={StaticResource FirstCharConverter}}"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsGroup}" Value="True">
|
||||
<DataTrigger Binding="{Binding IconCode}" Value="">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
@@ -98,6 +117,24 @@
|
||||
TextTrimming="CharacterEllipsis"
|
||||
MaxWidth="120"/>
|
||||
</StackPanel>
|
||||
<!-- 组合角标 -->
|
||||
<fa:IconBlock Icon="Cubes" FontSize="11"
|
||||
Foreground="{DynamicResource Theme.Accent}"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,4,6,0">
|
||||
<fa:IconBlock.Style>
|
||||
<Style TargetType="fa:IconBlock">
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsGroup}" Value="True">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</fa:IconBlock.Style>
|
||||
</fa:IconBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</Window.Resources>
|
||||
@@ -120,21 +157,13 @@
|
||||
<Border Grid.Column="0" Background="{DynamicResource Theme.SidebarBackground}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="42"/>
|
||||
<RowDefinition Height="42"/>
|
||||
<RowDefinition Height="45"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0"
|
||||
Text="个人工具箱"
|
||||
FontSize="18" FontWeight="Bold"
|
||||
Foreground="{DynamicResource Theme.Accent}"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"/>
|
||||
|
||||
<ListBox Grid.Row="1"
|
||||
<ListBox Grid.Row="0"
|
||||
x:Name="CategoryListBox"
|
||||
ItemsSource="{Binding Categories}"
|
||||
SelectedItem="{Binding SelectedCategory}"
|
||||
@@ -186,7 +215,7 @@
|
||||
</ListBox>
|
||||
|
||||
<!-- 分类管理按钮 -->
|
||||
<Button Grid.Row="2"
|
||||
<Button Grid.Row="1"
|
||||
Command="{Binding AddCategoryCommand}"
|
||||
Background="Transparent"
|
||||
BorderThickness="1"
|
||||
@@ -202,7 +231,7 @@
|
||||
</StackPanel>
|
||||
</Button>
|
||||
|
||||
<Button Grid.Row="3"
|
||||
<Button Grid.Row="2"
|
||||
Command="{Binding ToggleAutoStartCommand}"
|
||||
Background="Transparent"
|
||||
BorderThickness="1"
|
||||
@@ -224,7 +253,7 @@
|
||||
<TextBlock VerticalAlignment="Center" TextAlignment="Center"/>
|
||||
</Button>
|
||||
|
||||
<Button Grid.Row="4"
|
||||
<Button Grid.Row="3"
|
||||
Command="{Binding ToggleThemeCommand}"
|
||||
Background="Transparent"
|
||||
BorderThickness="1"
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Interop;
|
||||
using FontAwesome.Sharp;
|
||||
using PersonalToolBox.Helpers;
|
||||
using PersonalToolBox.ViewModels;
|
||||
|
||||
@@ -189,3 +190,19 @@ public class FirstCharConverter : IValueConverter
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
=> throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// string → IconChar: 将图标枚举名称字符串转换为 IconChar 枚举值
|
||||
/// </summary>
|
||||
public class StringToIconCharConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is string s && !string.IsNullOrEmpty(s) && System.Enum.TryParse<IconChar>(s, true, out var icon))
|
||||
return icon;
|
||||
return IconChar.None;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
=> throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:models="clr-namespace:PersonalToolBox.Models"
|
||||
Title="{Binding WindowTitle}" Height="380" Width="480"
|
||||
xmlns:fa="http://schemas.awesome.incremented/wpf/xaml/fontawesome.sharp"
|
||||
Title="{Binding WindowTitle}" Height="480" Width="520"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
ResizeMode="NoResize"
|
||||
Background="{DynamicResource Theme.Background}">
|
||||
|
||||
<Window.Resources>
|
||||
<!-- ComboBox 下拉项统一样式 -->
|
||||
<!-- ComboBox 下拉项样式 -->
|
||||
<Style TargetType="ComboBoxItem">
|
||||
<Setter Property="Background" Value="{DynamicResource Theme.InputBackground}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource Theme.Foreground}"/>
|
||||
@@ -19,7 +20,7 @@
|
||||
<Border x:Name="Border"
|
||||
Background="{TemplateBinding Background}"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter/>
|
||||
<ContentPresenter VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsHighlighted" Value="True">
|
||||
@@ -32,12 +33,13 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- ComboBox 整体样式(覆盖弹出层背景) -->
|
||||
<!-- ComboBox 整体样式(兼容 DisplayMemberPath 和 ItemTemplate) -->
|
||||
<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="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ComboBox">
|
||||
@@ -46,9 +48,8 @@
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
ClickMode="Press">
|
||||
<ToggleButton.Template>
|
||||
<ControlTemplate TargetType="ToggleButton">
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
@@ -56,11 +57,13 @@
|
||||
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"/>
|
||||
<ContentPresenter x:Name="ContentSite"
|
||||
Content="{Binding SelectionBoxItem, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"
|
||||
ContentTemplate="{Binding SelectionBoxItemTemplate, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"
|
||||
ContentStringFormat="{Binding SelectionBoxItemStringFormat, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}"
|
||||
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"/>
|
||||
@@ -81,7 +84,7 @@
|
||||
BorderBrush="{DynamicResource Theme.InputBorder}"
|
||||
BorderThickness="1"
|
||||
SnapsToDevicePixels="True">
|
||||
<ScrollViewer>
|
||||
<ScrollViewer CanContentScroll="False">
|
||||
<ItemsPresenter/>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
@@ -102,6 +105,7 @@
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
@@ -113,26 +117,67 @@
|
||||
|
||||
<!-- 工具名称 -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0"
|
||||
Text="名称:" Foreground="{DynamicResource Theme.Foreground}"
|
||||
Text="名称:"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
VerticalAlignment="Center" Margin="0,0,0,12"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}"
|
||||
Background="{DynamicResource Theme.InputBackground}"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
BorderBrush="{DynamicResource Theme.InputBorder}"
|
||||
VerticalContentAlignment="Center"
|
||||
Height="30" Margin="0,0,0,12" Padding="6,0"/>
|
||||
|
||||
<!-- 工具路径 -->
|
||||
<!-- 工具图标 -->
|
||||
<TextBlock Grid.Row="1" Grid.Column="0"
|
||||
Text="路径:" Foreground="{DynamicResource Theme.Foreground}"
|
||||
Text="图标:"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
VerticalAlignment="Center" Margin="0,0,0,12"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1"
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
ItemsSource="{Binding AvailableIconsView}"
|
||||
SelectedItem="{Binding SelectedIcon}"
|
||||
Height="30" Margin="0,0,0,12" Padding="4,0">
|
||||
<ComboBox.GroupStyle>
|
||||
<GroupStyle>
|
||||
<GroupStyle.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Name}"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{DynamicResource Theme.Accent}"
|
||||
FontSize="11"
|
||||
Margin="10,6,0,2"/>
|
||||
</DataTemplate>
|
||||
</GroupStyle.HeaderTemplate>
|
||||
</GroupStyle>
|
||||
</ComboBox.GroupStyle>
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<fa:IconBlock Icon="{Binding Icon}"
|
||||
FontSize="16" Width="28"
|
||||
Foreground="{DynamicResource Theme.Accent}"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding Name}"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
VerticalAlignment="Center" Margin="8,0,0,0"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<!-- 工具路径 -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
Text="路径:"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
VerticalAlignment="Center" Margin="0,0,0,12"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1"
|
||||
Text="{Binding ExecutablePath, UpdateSourceTrigger=PropertyChanged}"
|
||||
Background="{DynamicResource Theme.InputBackground}"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
BorderBrush="{DynamicResource Theme.InputBorder}"
|
||||
VerticalContentAlignment="Center"
|
||||
Height="30" Margin="0,0,0,12" Padding="6,0"/>
|
||||
<Button Grid.Row="1" Grid.Column="2"
|
||||
<Button Grid.Row="2" Grid.Column="2"
|
||||
Content="..."
|
||||
Command="{Binding BrowseFileCommand}"
|
||||
Background="{DynamicResource Theme.ButtonBackground}"
|
||||
@@ -142,50 +187,55 @@
|
||||
FontWeight="Bold" Cursor="Hand"/>
|
||||
|
||||
<!-- 运行参数 -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0"
|
||||
Text="参数:" Foreground="{DynamicResource Theme.Foreground}"
|
||||
<TextBlock Grid.Row="3" Grid.Column="0"
|
||||
Text="参数:"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
VerticalAlignment="Center" Margin="0,0,0,12"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
Text="{Binding Arguments, UpdateSourceTrigger=PropertyChanged}"
|
||||
Background="{DynamicResource Theme.InputBackground}"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
BorderBrush="{DynamicResource Theme.InputBorder}"
|
||||
VerticalContentAlignment="Center"
|
||||
Height="30" Margin="0,0,0,12" Padding="6,0"/>
|
||||
|
||||
<!-- 所属分类 -->
|
||||
<TextBlock Grid.Row="3" Grid.Column="0"
|
||||
Text="分类:" Foreground="{DynamicResource Theme.Foreground}"
|
||||
<TextBlock Grid.Row="4" Grid.Column="0"
|
||||
Text="分类:"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
VerticalAlignment="Center" Margin="0,0,0,12"/>
|
||||
<ComboBox Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
ItemsSource="{Binding Categories}"
|
||||
SelectedItem="{Binding SelectedCategory}"
|
||||
DisplayMemberPath="Name"
|
||||
Height="30" Margin="0,0,0,12" Padding="4,0"/>
|
||||
<ComboBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
ItemsSource="{Binding Categories}"
|
||||
SelectedItem="{Binding SelectedCategory}"
|
||||
DisplayMemberPath="Name"
|
||||
Height="30" Margin="0,0,0,12" Padding="4,0"/>
|
||||
|
||||
<!-- 全局快捷键 -->
|
||||
<TextBlock Grid.Row="4" Grid.Column="0"
|
||||
Text="快捷键:" Foreground="{DynamicResource Theme.Foreground}"
|
||||
<TextBlock Grid.Row="5" Grid.Column="0"
|
||||
Text="快捷键:"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
VerticalAlignment="Center" Margin="0,0,0,12"/>
|
||||
<TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
<TextBox Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
Text="{Binding HotKey, UpdateSourceTrigger=PropertyChanged}"
|
||||
Background="{DynamicResource Theme.InputBackground}"
|
||||
Foreground="{DynamicResource Theme.Foreground}"
|
||||
BorderBrush="{DynamicResource Theme.InputBorder}"
|
||||
VerticalContentAlignment="Center"
|
||||
Height="30" Margin="0,0,0,12" Padding="6,0"/>
|
||||
|
||||
<!-- 提示文字 -->
|
||||
<TextBlock Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
<TextBlock Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
Text="快捷键格式示例: Ctrl+Alt+T"
|
||||
Foreground="{DynamicResource Theme.TextSecondary}"
|
||||
FontSize="11" Margin="0,0,0,16"/>
|
||||
|
||||
<!-- 分隔线 -->
|
||||
<Border Grid.Row="6" Grid.ColumnSpan="3"
|
||||
<Border Grid.Row="7" Grid.ColumnSpan="3"
|
||||
BorderBrush="{DynamicResource Theme.CardBorder}"
|
||||
BorderThickness="0,1,0,0" Margin="0,0,0,14"/>
|
||||
|
||||
<!-- 按钮 -->
|
||||
<StackPanel Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
<StackPanel Grid.Row="8" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Content="保存"
|
||||
Command="{Binding SaveCommand}"
|
||||
|
||||
Reference in New Issue
Block a user