|
@@ -6,7 +6,9 @@ using Avalonia;
|
|
|
using Avalonia.Controls;
|
|
|
using Avalonia.Controls.Templates;
|
|
|
using Avalonia.Media;
|
|
|
+using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
+using InABox.Core;
|
|
|
using InABox.Avalonia;
|
|
|
using InABox.Avalonia.Converters;
|
|
|
|
|
@@ -31,6 +33,8 @@ public partial class PrsListView : UserControl
|
|
|
SetValue(SearchVisibleProperty, value);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public string SearchText { get; set; }
|
|
|
|
|
|
public static readonly StyledProperty<bool> FiltersVisibleProperty =
|
|
|
AvaloniaProperty.Register<PrsListView, bool>(nameof(FiltersVisible), true);
|
|
@@ -93,16 +97,6 @@ public partial class PrsListView : UserControl
|
|
|
}
|
|
|
});
|
|
|
|
|
|
-
|
|
|
- public static readonly StyledProperty<ICommand?> SearchCommandProperty =
|
|
|
- AvaloniaProperty.Register<PrsListView, ICommand?>(nameof(SearchCommand));
|
|
|
-
|
|
|
- public ICommand? SearchCommand
|
|
|
- {
|
|
|
- get => GetValue(SearchCommandProperty);
|
|
|
- set => SetValue(SearchCommandProperty, value);
|
|
|
- }
|
|
|
-
|
|
|
private void Search_OnTextChanged(object? sender, TextChangedEventArgs e)
|
|
|
{
|
|
|
if (sender is TextBox search && Repository != null)
|
|
@@ -110,4 +104,13 @@ public partial class PrsListView : UserControl
|
|
|
? shell.Match(search.Text)
|
|
|
: false);
|
|
|
}
|
|
|
+
|
|
|
+ [RelayCommand]
|
|
|
+ private void Search()
|
|
|
+ {
|
|
|
+ if (!SearchText.IsNullOrWhiteSpace() && Repository != null)
|
|
|
+ Repository.Search(o => o is IShell shell
|
|
|
+ ? shell.Match(SearchText)
|
|
|
+ : false);
|
|
|
+ }
|
|
|
}
|