You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Loaded event may be fired for an item that was already deleted from a ListView.
Steps to reproduce the bug
Load the solution from this repo.
If you inspect the solution code, you'll see the following. There is the ListView with custom ListView.ItemTemplate that uses Item control:
Run DebugView or any other utility that captures debug output.
Add some elements (say, 5) to the list using Add button. Every time you'll see the Loaded <id> message in DebugView. That's expected.
Then start removing elements from the list using Remove button.
You'll see that for the first removed item you'll see Unloaded <first_deleted_id> message that is expected. But after the deleting of the next item you'll see two messages:
So for some reason Loaded event is called for the item that was just deleted. If I rely on Loaded-Unloaded event in my application logic (for example, for notifying a viewmodel about some UI changes or making some subscription-unsubscriptions), then I'll get into a trouble since Loaded event is called for an item that is deleted and is not in the list.
Expected behavior
Loaded event shouldn't be raised for a ListView item, that was already deleted and it not being added.
Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.3.2: 1.3.230602002
Windows version
No response
Additional context
OS version is Win10 22HS 19045.3208
I can reproduce this problem also in 1.4.230628000-preview1 version of Windows App SDK.
The text was updated successfully, but these errors were encountered:
Describe the bug
Loaded
event may be fired for an item that was already deleted from aListView
.Steps to reproduce the bug
If you inspect the solution code, you'll see the following. There is the
ListView
with customListView.ItemTemplate
that usesItem
control:If we look into
Item
control, we'll see the following:Add
button. Every time you'll see theLoaded <id>
message in DebugView. That's expected.Remove
button.Unloaded <first_deleted_id>
message that is expected. But after the deleting of the next item you'll see two messages:So for some reason
Loaded
event is called for the item that was just deleted. If I rely onLoaded
-Unloaded
event in my application logic (for example, for notifying a viewmodel about some UI changes or making some subscription-unsubscriptions), then I'll get into a trouble sinceLoaded
event is called for an item that is deleted and is not in the list.Expected behavior
Loaded
event shouldn't be raised for aListView
item, that was already deleted and it not being added.Screenshots
No response
NuGet package version
WinUI 3 - Windows App SDK 1.3.2: 1.3.230602002
Windows version
No response
Additional context
OS version is
Win10 22HS 19045.3208
I can reproduce this problem also in
1.4.230628000-preview1
version ofWindows App SDK
.The text was updated successfully, but these errors were encountered: