|
@@ -35,6 +35,15 @@ public partial class SearchBar : UserControl
|
|
set => SetValue(TextProperty, value);
|
|
set => SetValue(TextProperty, value);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static readonly StyledProperty<bool> SearchOnChangedProperty =
|
|
|
|
+ AvaloniaProperty.Register<SearchBar, bool>(nameof(SearchOnChanged), true);
|
|
|
|
+
|
|
|
|
+ public bool SearchOnChanged
|
|
|
|
+ {
|
|
|
|
+ get => GetValue(SearchOnChangedProperty);
|
|
|
|
+ set => SetValue(SearchOnChangedProperty, value);
|
|
|
|
+ }
|
|
|
|
+
|
|
public SearchBar()
|
|
public SearchBar()
|
|
{
|
|
{
|
|
InitializeComponent();
|
|
InitializeComponent();
|
|
@@ -42,7 +51,7 @@ public partial class SearchBar : UserControl
|
|
|
|
|
|
private void TextBox_TextChanged(object? sender, TextChangedEventArgs e)
|
|
private void TextBox_TextChanged(object? sender, TextChangedEventArgs e)
|
|
{
|
|
{
|
|
- if (Command is not null && Command.CanExecute(null))
|
|
|
|
|
|
+ if (SearchOnChanged && Command is not null && Command.CanExecute(null))
|
|
{
|
|
{
|
|
Command.Execute(null);
|
|
Command.Execute(null);
|
|
}
|
|
}
|