Open ghost opened 2 years ago
Thank you @roland5572 for reporting this. Given this has been the case from Framework, we are unlikely to get it investigated on priority basis. If you like to investigate and propose a solution, we will be happy to help get it reviewed/fixed.
This issue is now marked as "up for grabs", and we’re looking for a community volunteer to work on this issue. If we receive no interest in 120 days, we will close the issue. To learn more about how we handle feature requests, please see our documentation.
Happy Coding!
Let me start working on these issues. I will come up with a solution shortly.
.NET version
6.0, 4.8
Did it work in .NET Framework?
No
Issue description
In the ListView control, set OwnerDraw = true, then you can overload the OnDrawSubItem function. https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.listview.ondrawsubitem
When you select an Item, then click on an empty/blank space in the ListView. This operation will result in no items being selected (ListView.SelectedItems.Count==0). But the wrong value may appear in the OnDrawSubItem method (DrawListViewSubItemEventArgs e).
e.ItemState still equals ListViewItemStates.Selected | ListViewItemStates.Focused
Test Code: .net 6.0 / Visual Studio 2022
Steps to reproduce
normal control behavior:
Incorrect control behavior:
Because the value of the parameter of DrawListViewSubItemEventArgs e (e.ItemState) is wrong, the item background behaves as Orange.
If you can't reproduce the process, or need a video, please let me know.