diff --git a/samples/ControlCatalog/Pages/ComboBoxPage.xaml b/samples/ControlCatalog/Pages/ComboBoxPage.xaml
index ab347ac30c..bed7d2fe48 100644
--- a/samples/ControlCatalog/Pages/ComboBoxPage.xaml
+++ b/samples/ControlCatalog/Pages/ComboBoxPage.xaml
@@ -102,9 +102,8 @@
-
-
+ DisplayMemberBinding="{Binding Name}"
+ TextSearch.TextBinding="{Binding SearchText, DataType=viewModels:IdAndName}" />
Values { get; set; } = new ObservableCollection
{
- new IdAndName(){ Id = "Id 1", Name = "Name 1" },
- new IdAndName(){ Id = "Id 2", Name = "Name 2" },
- new IdAndName(){ Id = "Id 3", Name = "Name 3" },
- new IdAndName(){ Id = "Id 4", Name = "Name 4" },
- new IdAndName(){ Id = "Id 5", Name = "Name 5" },
+ new IdAndName(){ Id = "Id 1", Name = "Name 1", SearchText = "A" },
+ new IdAndName(){ Id = "Id 2", Name = "Name 2", SearchText = "B" },
+ new IdAndName(){ Id = "Id 3", Name = "Name 3", SearchText = "C" },
+ new IdAndName(){ Id = "Id 4", Name = "Name 4", SearchText = "D" },
+ new IdAndName(){ Id = "Id 5", Name = "Name 5", SearchText = "E" },
};
}
@@ -31,5 +31,6 @@ namespace ControlCatalog.ViewModels
{
public string? Id { get; set; }
public string? Name { get; set; }
+ public string? SearchText { get; set; }
}
}
diff --git a/src/Avalonia.Controls/AutoCompleteBox/AutoCompleteBox.cs b/src/Avalonia.Controls/AutoCompleteBox/AutoCompleteBox.cs
index b142ce5eb2..4241f6315f 100644
--- a/src/Avalonia.Controls/AutoCompleteBox/AutoCompleteBox.cs
+++ b/src/Avalonia.Controls/AutoCompleteBox/AutoCompleteBox.cs
@@ -2036,6 +2036,7 @@ namespace Avalonia.Controls
}
}
+ // TODO12: Remove, this shouldn't be part of the public API. Use our internal BindingEvaluator instead.
///
/// A framework element that permits a binding to be evaluated in a new data
/// context leaf node.
diff --git a/src/Avalonia.Controls/Presenters/ItemsPresenter.cs b/src/Avalonia.Controls/Presenters/ItemsPresenter.cs
index 58d0e797fe..3b9f0b08d3 100644
--- a/src/Avalonia.Controls/Presenters/ItemsPresenter.cs
+++ b/src/Avalonia.Controls/Presenters/ItemsPresenter.cs
@@ -197,44 +197,6 @@ namespace Avalonia.Controls.Presenters
return Panel?.Children;
}
- internal static bool ControlMatchesTextSearch(Control control, string textSearchTerm)
- {
- if (control is AvaloniaObject ao && ao.IsSet(TextSearch.TextProperty))
- {
- var searchText = ao.GetValue(TextSearch.TextProperty);
-
- if (searchText?.StartsWith(textSearchTerm, StringComparison.OrdinalIgnoreCase) == true)
- {
- return true;
- }
- }
- return control is IContentControl cc &&
- cc.Content?.ToString()?.StartsWith(textSearchTerm, StringComparison.OrdinalIgnoreCase) == true;
- }
-
- internal int GetIndexFromTextSearch(string textSearch)
- {
- if (Panel is VirtualizingPanel v)
- return v.GetIndexFromTextSearch(textSearch);
- return GetIndexFromTextSearch(ItemsControl?.Items, textSearch);
- }
-
- internal static int GetIndexFromTextSearch(IReadOnlyList