Files
XplorePlane/XplorePlane/Views/ImageProcessing/OperatorToolboxView.xaml
T
2026-04-13 14:36:18 +08:00

164 lines
10 KiB
XML

<UserControl x:Class="XplorePlane.Views.OperatorToolboxView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:prism="http://prismlibrary.com/"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
prism:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="280">
<UserControl.Resources>
<SolidColorBrush x:Key="PanelBg" Color="White" />
<SolidColorBrush x:Key="PanelBorder" Color="#cdcbcb" />
<SolidColorBrush x:Key="CategoryBg" Color="#F5F7FA" />
<SolidColorBrush x:Key="HoverBg" Color="#E8F0FE" />
<FontFamily x:Key="CsdFont">Microsoft YaHei UI</FontFamily>
</UserControl.Resources>
<Border Background="{StaticResource PanelBg}"
BorderBrush="{StaticResource PanelBorder}"
BorderThickness="1" CornerRadius="4">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 标题(支持无边框窗口拖拽) -->
<Border x:Name="TitleBar" Grid.Row="0" Background="#0060A0" Padding="10,8">
<Grid>
<TextBlock Text="🧰 算子工具箱" FontFamily="{StaticResource CsdFont}"
FontWeight="Bold" FontSize="13" Foreground="White"
VerticalAlignment="Center" />
<Button x:Name="CloseBtn" HorizontalAlignment="Right" VerticalAlignment="Center"
Content="✕" FontSize="12" Foreground="White" Cursor="Hand"
Visibility="Collapsed"
ToolTip="关闭">
<Button.Style>
<Style TargetType="Button">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Padding" Value="6,2" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
CornerRadius="3" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E04040" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Style>
</Button>
</Grid>
</Border>
<!-- 搜索框 -->
<Border Grid.Row="1" Padding="8,6" BorderBrush="{StaticResource PanelBorder}"
BorderThickness="0,0,0,1">
<TextBox Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}"
FontFamily="{StaticResource CsdFont}" FontSize="11"
Padding="6,4" BorderBrush="#cdcbcb" BorderThickness="1"
ToolTip="输入关键字搜索算子">
<TextBox.Style>
<Style TargetType="TextBox">
<Style.Triggers>
<Trigger Property="Text" Value="">
<Setter Property="Background">
<Setter.Value>
<VisualBrush AlignmentX="Left" AlignmentY="Center" Stretch="None">
<VisualBrush.Visual>
<TextBlock Text="🔍 搜索算子..." Foreground="#aaa"
FontFamily="Microsoft YaHei UI" FontSize="11"
Margin="4,0,0,0" />
</VisualBrush.Visual>
</VisualBrush>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
</Border>
<!-- 分组算子列表 -->
<ScrollViewer x:Name="ToolboxListBox" Grid.Row="2" VerticalScrollBarVisibility="Auto">
<ItemsControl ItemsSource="{Binding FilteredGroups}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,2">
<!-- 分类标题 -->
<Border Background="{StaticResource CategoryBg}"
BorderBrush="{StaticResource PanelBorder}"
BorderThickness="0,0,0,1"
Padding="10,6">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding CategoryIcon}" FontSize="13"
VerticalAlignment="Center" Margin="0,0,6,0" />
<TextBlock Text="{Binding CategoryName}"
FontFamily="Microsoft YaHei UI"
FontWeight="SemiBold" FontSize="12"
Foreground="#333" VerticalAlignment="Center" />
</StackPanel>
</Border>
<!-- 分类下的算子 -->
<ItemsControl ItemsSource="{Binding Operators}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Padding="12,5,8,5" Cursor="Hand"
Background="Transparent"
BorderBrush="Transparent"
BorderThickness="0,0,0,1">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#E8F0FE" />
</Trigger>
</Style.Triggers>
</Style>
</Border.Style>
<StackPanel Orientation="Horizontal">
<Border Width="26" Height="26"
Background="#EEF2FF"
CornerRadius="4" Margin="0,0,8,0">
<TextBlock Text="{Binding IconPath}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="14" />
</Border>
<StackPanel VerticalAlignment="Center">
<TextBlock Text="{Binding DisplayName}"
FontFamily="Microsoft YaHei UI"
FontSize="11.5"
Foreground="#1c1c1b" />
<TextBlock Text="{Binding Key}"
FontFamily="Consolas"
FontSize="9.5"
Foreground="#999" />
</StackPanel>
</StackPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Border>
</UserControl>