microsoft/microsoft-ui-xaml

ListView Fails to Remove Multiple Items with RemoveRange Operation in Bound Collection

Opened this issue · 1 comments

Describe the bug

In a ListView with a bound Collection, the RemoveRange operation does not remove multiple items as intended. Instead of deleting the specified range of items (e.g., from index 0 to 4), only a single item is removed. This issue disrupts the functionality of bulk removal operations in ListView collections.

Steps to reproduce the bug

  • Run the attached sample application - ListViewTestSample.zip.

  • Click the "Remove" button in the view.

  • Observe that the ListView does not remove the specified range of items.

Expected behavior

Upon clicking the "Remove" button:

  • Five items (indices 0 through 4) should be removed from the collection.

  • The ListView should update accordingly to reflect the removal of these five items simultaneously.

Screenshots

Before Button Click :

Image

After Button Click :

Image

NuGet package version

WinUI 3 - Windows App SDK 1.6.3: 1.6.241114003

Windows version

Windows 11 (23H2): Build 22631

Additional context

No response

It works for me (Windows 10 22H2, Windows App SDK 1.6.241114003)
if I do instead :
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));