Skip to content

Commit 79a63f5

Browse files
committed
fix(combobox): do not refresh the virtualized panel every time the drop down menu is opened
1 parent 240af4f commit 79a63f5

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/Uno.UI/UI/Xaml/Controls/ComboBox/ComboBox.partial.mux.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
using System;
1010
using System.Collections.Generic;
11+
using System.Collections.Specialized;
1112
using DirectUI;
1213
using Microsoft.UI.Xaml.Automation.Peers;
1314
using Microsoft.UI.Xaml.Controls.Primitives;
@@ -904,16 +905,19 @@ private void UpdateSelectionBoxHighlighted()
904905
IsSelectionBoxHighlighted = value;
905906
}
906907

907-
private void OnOpen()
908-
{
909-
910908
#if HAS_UNO
911-
// Force a refresh of the popup's ItemPresenter
909+
private protected override void UpdateItems(NotifyCollectionChangedEventArgs args)
910+
{
911+
// With virtualization, the base.UpdateItems won't handle the updates
912+
// (because ShouldItemsControlManageChildren is false), so we make an
913+
// explicit call to Refresh here instead.
914+
base.UpdateItems(args);
912915
Refresh();
913-
914-
RestoreSelectedItem();
916+
}
915917
#endif
916918

919+
private void OnOpen()
920+
{
917921
// TODO Uno: BackButton support
918922
//if (DXamlCore.Current.BackButtonSupported)
919923
//{

0 commit comments

Comments
 (0)