Nested measure on ListView
may cause duplicate items
#4925
Labels
area/listview 📃
Categorizes an issue or PR as relevant to the ListView control
difficulty/medium 🤔
Categorizes an issue for which the difficulty level is reachable with a good understanding of WinUI
kind/bug
Something isn't working
project/items 🧾
Categorizes an issue or PR as relevant to items (ItemsControl, ItemsRepeater, ...)
Current behavior
TabView
source callsUpdateLayout
on one of the children ofTabView
. When this happens during Measure ofTabListView
, it causes nested call of measure, so all items are constructed twice which breaks things like selection (first item cannot be unselected). Due to the differences in control lifetime,UpdateLayout
call is not needed in Uno, but the underlying issue still persists.This may be caused by the fact that
OnContainerChanging
is called during the measure phase.This problem is applicable to
ListView
in general, not only forTabViewListView
Expected behavior
Nested measure call should not produce duplicate set of items.
How to reproduce it (as minimally and precisely as possible)
Uncomment
tabContentPresenter.UpdateLayout()
inTabView.cs
and debugTabViewItemsSourceTests
page. Add a breakpoint in theTabViewItem
constructor and observe that it is called too many times. Also notice that first item cannot be unselected - because it is in fact just a duplicate of the actual first item.Workaround
Environment
Nuget Package Version(s):
Affected platform(s):
May be on other targets too.
IDE:
Relevant plugins:
Anything else we need to know?
The text was updated successfully, but these errors were encountered: