Controls in ListView.Header may end up in unload state after changing the ListView.ItemsPanel #7535
Labels
area-Lists
ListView, GridView, ListBox, etc
bug
Something isn't working
duplicate
This issue or pull request already exists
product-winui2
team-Controls
Issue for the Controls team
Describe the bug
When changing the
ItemsPanel
value of a givenListView
, the control child of theListView.Header
will be unload and reload again reusing the same instance.Issue is that often a race condition occurs and the
ListView.Header
control child receive the load event first and then unload one, meaning we end up with controls in an unload state in theListView.Header
.Steps to reproduce the bug
Create a UWP project with the following:
.xaml:
.xaml.cs:
To repro, just click on the
Button
until theProgressRing
is no longer visible.Expected behavior
While changing a
ListView.ItemsPanel
value theListView.Header
control child must always receive the unload and load event in the right order.Screenshots
As you can see, based on its hashcode 23318221, the
ProgressRing
control instance is reused after updating theListView.ItemsPanel
. It also received the second load event before the unload event, which explains why theProgressRing
is not animated anymore due to its unloaded state.NuGet package version
Microsoft.UI.Xaml 2.8.0
Windows app type
Device form factor
Desktop
Windows version
Windows 11 (21H2): Build 22000
Additional context
No response
The text was updated successfully, but these errors were encountered: