The ListView control in System.Windows.Forms 2.0 has a bug

Oh my, the end users are going to get really entertained with this bug.

I’m trying to present images as icons on a list view and the end user should drag and drop the image to the desired location inside the list view to have their list ordered. Unfortunately no matter to which position you drag and drop the image, the image is always placed at the end.
I found a forum post about this with no solution:
Inserting items at specific index in listviews (c# .net 2.0)

If anyone knows of a workaround, I would be more than happy to know. Poor end users will have to get a lot of training to realize the drag and drop only drops the items at the end…

Thanks for the connect program at MSDN.
There is a published workaround here:
MSDN Connect Issue # 115345

And at the end all the fault is on the Win32 List View implementation on which this .net control is based:

MSDN Connect Issue # 94685

Note the published workaround won’t work if you’re not using Groups on your ListView. I modified this to work directly with the ListViewItem Items collection. I might publish an extended version of the control here with this fix if time permits…

Happy coding!

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.