dotnet / dotnet/winforms

ListViewItem does not reset its "Selected" flag after removing from ListView

Open
#6,612 2 comments 0 reactions 0 assignees View on GitHub
area-controls-ListView help wanted
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

.NET Core Version:
- 7.0.0-preview.2.22102.1

Have you experienced this same bug with .NET Framework?:
- Yes

**Problem description:**

1. Create a `Form` with a `ListView`
2. Add several `ListViewItems`
3. Add an event to remove an `ListViewItem` when the key is pressed
4. Add a `MessageBox` with the status of the `ListViewItem` after deletion to the event above
5. Run the application
6. Set focus to an `ListViewItem`
7. Delete an `ListViewItem` by pressing the key

**Actual behavior:**
The `ListViewItem.Selected` have the value `True`
![image](https://user-images.githubusercontent.com/23376742/152348958-49a8c0b5-b7c7-4e91-a77f-8dfebc41ac36.png)

**Expected behavior:**
The `ListViewItem.Selected` should have the value `False` (according to `TreeView` behavior)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.