diff --git a/samples/ControlCatalog/Pages/ComboBoxPage.xaml b/samples/ControlCatalog/Pages/ComboBoxPage.xaml
index 748a46c447..f3f6cfe0af 100644
--- a/samples/ControlCatalog/Pages/ComboBoxPage.xaml
+++ b/samples/ControlCatalog/Pages/ComboBoxPage.xaml
@@ -98,6 +98,21 @@
Inline Item 3
Inline Item 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
WrapSelection
diff --git a/samples/ControlCatalog/ViewModels/ComboBoxPageViewModel.cs b/samples/ControlCatalog/ViewModels/ComboBoxPageViewModel.cs
index d3e4ea7c31..6ab7bb02e3 100644
--- a/samples/ControlCatalog/ViewModels/ComboBoxPageViewModel.cs
+++ b/samples/ControlCatalog/ViewModels/ComboBoxPageViewModel.cs
@@ -16,5 +16,20 @@ namespace ControlCatalog.ViewModels
get => _wrapSelection;
set => this.RaiseAndSetIfChanged(ref _wrapSelection, value);
}
+
+ public ObservableCollection 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" },
+ };
+ }
+
+ public class IdAndName
+ {
+ public string Id { get; set; }
+ public string Name { get; set; }
}
}
diff --git a/src/Avalonia.Controls/ComboBox.cs b/src/Avalonia.Controls/ComboBox.cs
index 1234b66383..dadda4e0ec 100644
--- a/src/Avalonia.Controls/ComboBox.cs
+++ b/src/Avalonia.Controls/ComboBox.cs
@@ -443,7 +443,22 @@ namespace Avalonia.Controls
}
else
{
- SelectionBoxItem = item;
+ if(ItemTemplate is null && DisplayMemberBinding is { } binding)
+ {
+ var template = new FuncDataTemplate