修复算子工具箱搜索功能
This commit is contained in:
@@ -36,6 +36,7 @@ namespace XplorePlane.ViewModels
|
||||
{
|
||||
private readonly IImageProcessingService _imageProcessingService;
|
||||
private string _searchText = string.Empty;
|
||||
private OperatorGroupViewModel _selectedGroup;
|
||||
|
||||
// UI 元数据(分类 + 图标)由 ProcessorUiMetadata 统一提供,保持工具箱与流水线图标一致
|
||||
|
||||
@@ -52,6 +53,12 @@ namespace XplorePlane.ViewModels
|
||||
public ObservableCollection<OperatorDescriptor> FilteredOperators { get; }
|
||||
public ObservableCollection<OperatorGroupViewModel> FilteredGroups { get; }
|
||||
|
||||
public OperatorGroupViewModel SelectedGroup
|
||||
{
|
||||
get => _selectedGroup;
|
||||
set => SetProperty(ref _selectedGroup, value);
|
||||
}
|
||||
|
||||
public string SearchText
|
||||
{
|
||||
get => _searchText;
|
||||
@@ -78,6 +85,7 @@ namespace XplorePlane.ViewModels
|
||||
{
|
||||
FilteredOperators.Clear();
|
||||
FilteredGroups.Clear();
|
||||
SelectedGroup = null;
|
||||
|
||||
var filtered = string.IsNullOrWhiteSpace(SearchText)
|
||||
? AvailableOperators
|
||||
@@ -101,6 +109,8 @@ namespace XplorePlane.ViewModels
|
||||
Operators = new ObservableCollection<OperatorDescriptor>(group)
|
||||
});
|
||||
}
|
||||
|
||||
SelectedGroup = FilteredGroups.FirstOrDefault();
|
||||
}
|
||||
|
||||
private static int GetCategoryOrder(string category) => category switch
|
||||
|
||||
@@ -100,6 +100,7 @@
|
||||
<TabControl x:Name="ToolboxListBox"
|
||||
Margin="8"
|
||||
ItemContainerStyle="{StaticResource OperatorToolboxTabItemStyle}"
|
||||
SelectedItem="{Binding SelectedGroup, Mode=TwoWay}"
|
||||
ItemsSource="{Binding FilteredGroups}">
|
||||
<TabControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:views="clr-namespace:XplorePlane.Views"
|
||||
Title="算子工具箱"
|
||||
Width="500" Height="560"
|
||||
Width="460" Height="540"
|
||||
MinWidth="420" MinHeight="500"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
ShowInTaskbar="False"
|
||||
WindowStyle="None"
|
||||
|
||||
Reference in New Issue
Block a user