Repository navigation
Conversation
Xiaoy312
force-pushed
the
dev/xygu/20261111/listbox-port
branch
from
November 12, 2026 05:25
b21d4b0 to
13dd4d5
Compare
2 of 5 tasks
Xiaoy312
force-pushed
the
dev/xygu/20261111/listbox-port
branch
from
November 12, 2026 07:04
13dd4d5 to
3f60a9b
Compare
Xiaoy312
force-pushed
the
dev/xygu/20261111/itemscontrol-virtualizing-panel-dupes
branch
from
November 12, 2026 07:04
fa88651 to
13fa8c1
Compare
VirtualizingStackPanel threw from GetLayouter on Skia, so any ItemsControl using it, like the default ListBox template, showed no items. Under a Selector it now borrows ItemsStackPanelLayout, like CarouselPanel, and creates it only then; under a plain ItemsControl, which adds the containers itself, it stacks them without virtualizing, as WinUI does. Orientation is implemented. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Moves it to Selector so other selectors on a virtualizing panel can use it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ports ListBox_Partial.cpp: ListBoxItem containers, SelectionMode (Single, Multiple, Extended with an anchor), SelectedItems, SelectAll, SingleSelectionFollowsFocus, ScrollIntoView, and keyboard navigation and selection. Uno's Selector has no multi-selection store, so, as in ListViewBase, SelectedItems holds it and SelectedIndex/SelectedItem follow its first item; item changes, SelectionMode and ItemsSource changes, and app changes to SelectedItems behave as on WinUI. Selector's checks for its subclasses become virtual members, so UI Automation's AddToSelection/RemoveFromSelection work for a ListBox too. Fixes #1362 Co-Authored-By: Claude Opus 5.5 <[email protected]>
A manual test page for the selection modes: clicks with modifiers, the keyboard, SingleSelectionFollowsFocus, SelectAll and item insertions, with the selection and the SelectionChanged events shown next to it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A plain ItemsControl added a container per item to an ItemsStackPanel (or CarouselPanel) while the panel's layout generated its own, so every item had two containers, and item changes never reached the layout. The ItemsControl now leaves those panels' children to their layout and refreshes it on item changes. A VirtualizingStackPanel stays managed by the ItemsControl: WinUI realizes all of its items there. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Under a Selector other than ListViewBase and ComboBox (ListBox, FlipView, ...), a VirtualizingStackPanel generates its containers from its borrowed ItemsStackPanel layout, but the ItemsControl only refreshed the layout of an ItemsStackPanel or CarouselPanel on item changes. It now refreshes the layout of any virtualizing panel whose children it doesn't manage. This replaces ListBox's own UpdateItems override, which refreshed the same layout a second time on every item change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The virtualizing layout only recorded the bounds of ContentControl containers, so the ContentPresenter containers of a plain ItemsControl were all arranged at offset 0 and overlapped. The bounds live on UIElement, so record them for any container. Co-Authored-By: Claude Opus 5.5 <[email protected]>
An item change under a panel that generates its own containers (a ListBox's VirtualizingStackPanel, an ItemsControl's ItemsStackPanel) refreshed the whole layout, which recycled every realized container: the focused item lost the focus on any insertion or removal, even one far outside the viewport. The ItemsControl now forwards additions, removals and moves to the layout and repairs the realized containers' indices, as ListViewBase does (its index repair moves to ItemsControl), and rebinds the realized containers of replaced items. Grouped sources and resets still refresh. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Xiaoy312
force-pushed
the
dev/xygu/20261111/listbox-port
branch
from
November 12, 2026 08:49
3f60a9b to
466ca06
Compare
Xiaoy312
force-pushed
the
dev/xygu/20261111/itemscontrol-virtualizing-panel-dupes
branch
from
November 12, 2026 08:49
13fa8c1 to
c3158fd
Compare
Xiaoy312
force-pushed
the
dev/xygu/20261111/listbox-port
branch
from
November 12, 2026 17:59
466ca06 to
06595d2
Compare
Xiaoy312
force-pushed
the
dev/xygu/20261111/listbox-port
branch
from
November 25, 2026 20:55
06595d2 to
41f25fd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub Issue: closes #25458, closes #16531
Note
Stacked on #26321 (
dev/xygu/20261111/listbox-port): review only the last four commits. Retarget tomasteronce #26321 merges.PR Type:
🐞 Bugfix
What changed? 🚀
With an
ItemsStackPanelas theItemsPanelof a plainItemsControl, Uno created two containers per item, and the ones that were laid out all sat at offset 0, on top of each other.ItemsControladded a container per item, while the panel's virtualizing layout generated its own.ItemsControlnow leaves the children of anItemsStackPanel(andCarouselPanel, which reuses its layout) to the panel, and refreshes the layout when the items change. Before, nothing told the layout about item changes, so removed or replaced items stayed on screen.VirtualizingStackPanelkeeps being managed by a plainItemsControl, because that's what WinUI does: measured on WinAppSDK, a plainItemsControlwith aVirtualizingStackPanelrealizes all 1,000 of 1,000 items, while one with anItemsStackPanelrealizes 15 to 41. So the stacking fallback fix(listbox): Implement ListBox containers and selection #26321 adds forVirtualizingStackPanelmatches WinUI.Selectors. With fix(listbox): Implement ListBox containers and selection #26321, theVirtualizingStackPanelof aListBox(or of anySelectorother thanListViewBaseandComboBox) generates its containers from the same layout. fix(listbox): Implement ListBox containers and selection #26321 refreshes it from aListBox-onlyUpdateItemsoverride. The refresh now lives inItemsControland covers any virtualizing panel whose children theItemsControldoesn't manage, so that override is removed: keeping both would refresh aListBox's layout twice per change.ListViewBaseforwards changes incrementally andComboBoxalready refreshes, so both opt out.ItemsControlforwards additions, removals and moves to the panel's layout and repairs the realized containers' indices, asListViewBasedoes.ListViewBase's index repair moves toItemsControlfor that. Replaced items rebind their realized containers; grouped sources and resets still refresh.ContentControlcontainers, but a plainItemsControl's containers areContentPresenters. The bounds live onUIElement, so they're now stored for any container.Not covered here:
ItemsControl, where WinUI virtualizes: the layout only follows aScrollViewerfound before reaching theItemsControl, and assumes the panel starts at the scroll origin. Inside an outerScrollViewerthe panel also reports only the viewport's height, so it doesn't scroll. That was already the case before this PR.ItemsWrapGridis still an unimplemented stub on Skia, so it shows nothing under a plainItemsControl.CarouselPaneloutside of aComboBox; Uno keeps accepting it.Validation
Given_ItemsControltests fail on fix(listbox): Implement ListBox containers and selection #26321 alone (5 of them) and pass with the fixes. The newGiven_ListBoxcontainers test passes on fix(listbox): Implement ListBox containers and selection #26321 alone too, because of the override this PR replaces; it guards the generic path. The newGiven_ListBoxfocus test fails without the incremental forwarding (the focus leaves the list on an insertion far below the viewport) and passes with it;Given_ItemsControl,Given_ListBox,Given_VirtualizingStackPanel,Given_ComboBox,Given_ListViewBase,Given_ListViewBase_Items,Given_FlipView,Given_GridView_Items,Given_TabView,Given_CalendarView,Given_ItemsStackPanel,Given_Selector,Given_AccessibleListView: 305 passed, 0 failed, 22 skipped, 1 inconclusive (When_Large_List_Scroll_To_End_Then_Back_Up_TryClick, also inconclusive onmaster).Given_ItemsControl,Given_ListBox,Given_VirtualizingStackPanel: 48/48 pass, including the new tests. 6 are skipped: theCarouselPanelone, since WinUI rejects that panel, and fix(listbox): Implement ListBox containers and selection #26321's Uno-only input tests.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code