microsoft / microsoft/microsoft-ui-xaml

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

Open
#10,235 3 comments 0 reactions 0 assignees View on GitHub
area-Lists bug
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

### 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](https://github.com/user-attachments/files/18134450/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](https://github.com/user-attachments/assets/94ca1e35-57fb-4e93-ac64-bc7cc13f93bd)

**After Button Click :**

![Image](https://github.com/user-attachments/assets/45f1b8d1-329f-40eb-bfa7-401844f1b5ba)

### 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_

Contributor guide

Open the contributing guide

Research direction

Run the attached ListViewTestSample.zip and reproduce the RemoveRange action from the view's Remove button. Trace the bound Collection change handling and verify that removing indices 0 through 4 produces five removals and updates the ListView accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.