diff --git a/AutoStartConfirmLib/GUI/MainPage.xaml b/AutoStartConfirmLib/GUI/MainPage.xaml
index 5655f48..4c22e41 100644
--- a/AutoStartConfirmLib/GUI/MainPage.xaml
+++ b/AutoStartConfirmLib/GUI/MainPage.xaml
@@ -24,8 +24,7 @@
-
-
+
diff --git a/AutoStartConfirmLib/GUI/MainPage.xaml.cs b/AutoStartConfirmLib/GUI/MainPage.xaml.cs
index f7794fa..bc5cc18 100644
--- a/AutoStartConfirmLib/GUI/MainPage.xaml.cs
+++ b/AutoStartConfirmLib/GUI/MainPage.xaml.cs
@@ -466,23 +466,6 @@ public static bool CanBeIgnoredConverter(AutoStartEntry autoStart)
return false;
}
- private void SearchBox_TextChanged(object sender, TextChangedEventArgs _)
- {
- string newText = ((TextBox)sender).Text;
-
- // reset the filter
- AutoStartCollectionView.Filter = _ => true;
- HistoryAutoStartCollectionView.Filter = _ => true;
- IgnoredCollectionView.Filter = _ => true;
-
- if (!string.IsNullOrWhiteSpace(newText))
- {
- AutoStartCollectionView.Filter = x => ((AutoStartEntry)x).Value.Contains(newText) || ((AutoStartEntry)x).Path.Contains(newText) || ((AutoStartEntry)x).CategoryAsString.Contains(newText);
- HistoryAutoStartCollectionView.Filter = x => ((AutoStartEntry)x).Value.Contains(newText) || ((AutoStartEntry)x).Path.Contains(newText) || ((AutoStartEntry)x).CategoryAsString.Contains(newText);
- IgnoredCollectionView.Filter = x => ((IgnoredAutoStart)x).Value.Contains(newText) || ((IgnoredAutoStart)x).Path.Contains(newText) || ((IgnoredAutoStart)x).CategoryAsString.Contains(newText);
- }
- }
-
private void Dispose(bool disposing)
{
@@ -503,5 +486,43 @@ public void Dispose()
GC.SuppressFinalize(this);
}
+ private void SearchBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
+ {
+ string newText = sender.Text;
+
+ // reset the filter
+ AutoStartCollectionView.Filter = _ => true;
+ HistoryAutoStartCollectionView.Filter = _ => true;
+ IgnoredCollectionView.Filter = _ => true;
+
+ if (!string.IsNullOrWhiteSpace(newText))
+ {
+ // Because of a bug in AdvancedCollectionView, currently it is not possible to filter the last element
+ // If tired, ArgumentOutOfRangeException is thrown
+ // For now ignore ArgumentOutOfRangeException
+ // See https://github.com/CommunityToolkit/WindowsCommunityToolkit/issues/2913
+ try
+ {
+ AutoStartCollectionView.Filter = x => ((AutoStartEntry)x).Value.Contains(newText, StringComparison.OrdinalIgnoreCase) || ((AutoStartEntry)x).Path.Contains(newText, StringComparison.OrdinalIgnoreCase) || ((AutoStartEntry)x).CategoryAsString.Contains(newText, StringComparison.OrdinalIgnoreCase);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ }
+ try
+ {
+ HistoryAutoStartCollectionView.Filter = x => ((AutoStartEntry)x).Value.Contains(newText, StringComparison.OrdinalIgnoreCase) || ((AutoStartEntry)x).Path.Contains(newText, StringComparison.OrdinalIgnoreCase) || ((AutoStartEntry)x).CategoryAsString.Contains(newText, StringComparison.OrdinalIgnoreCase);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ }
+ try
+ {
+ IgnoredCollectionView.Filter = x => ((IgnoredAutoStart)x).Value.Contains(newText, StringComparison.OrdinalIgnoreCase) || ((IgnoredAutoStart)x).Path.Contains(newText, StringComparison.OrdinalIgnoreCase) || ((IgnoredAutoStart)x).CategoryAsString.Contains(newText, StringComparison.OrdinalIgnoreCase);
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ }
+ }
+ }
}
}