How I learned to stop worrying and love .NET ListView
How I learned to stop worrying and love .NET ListView
ObjectListView is a C# wrapper around a .NET ListView. It makes the ListView much easier to use and provides some neat extra functionality.
Larry Wall, the author of Perl, once wrote that the three essential character flaws of any good programmer were sloth, impatience and hubris. Good programmers want to do the minimum amount of work (sloth). They want their programs to run quickly (impatience). They take inordinate pride in what they have written (hubris).
ObjectListView encourages the vices of sloth and hubris, by allowing programmers to do far less work but still produce great looking results.
Here is an example of what your ListView can look like with a few callbacks in place:
On Vista, the groups look even better:
The TreeListView similarly make a tree structure look beautiful:
And this is the report that can be effortlessly produced from the ObjectListView:
With a little work, you can even pretend to live in the halls of cool with something like this:
OK, here’s the bullet point feature list:
Seriously, after using an ObjectListView, you will never go back to using a plain ListView.
The source code to ObjectListView can be downloaded here. You can also download a demonstration, documentation and unit tests on the same page.
After that, you might want to look at the Getting Started and the Learning to cook sections. Please make sure you have read and understood these sections before asking questions in the Forum. There is also an article describing the ObjectListView at CodeProject.
At some point, you will want to do something with an ObjectListView and it won’t be immediately obvious how to make it happen. After dutifully scouring the Getting Started and the Learning to cook sections, you decide that is is still not obvious. The Forum section is the place to find all your as-yet- unasked questions.
If you would like to ask me a question or suggest an improvement, you can contact me here: email@example.com.
I’ve started keeping a technical blog documenting some of the efforts that were required to solve some of the problem encountered within the ObjectListView.
When thinking about using some new code, it’s always interesting to hear what others have said about it.
I have to ask you where I should send the check! Your work is absolutely amazing! You have managed to create a control so powerful, so simple, and so useful that it boggles the mind. I can see this control in every forms application I create from this day forward. Thank you very much for sharing this.
Thank you very much, this is a great piece of work. ... It is easy to work with, fast and it looks great! I will replace all lists and in my application with it, and I will have a lot of fun doing this :)
I have been using your tool for over a year now and it is absolutely incredible. It has solved almost all of my problems with the listview and I can’t thank you enough for sharing this.
This is a very impressive piece of work. I can now dispense with the existing .net list/grid controls and just use this control, plus get so much more easy to use functionality. Outstanding. Thanks!
Just want to say thanks for such an amazing control. I’m blown away with the level and thought put into the documentation (as a developer, I personally hate documenting things). So thanks, awesome stuff :)
Just a small THANK YOU for taking the time to code something as good as ObjectListView. It works extremely well, and is an absolute joy to work with, even for us beginners! Much appreciated.
Easily the best ListView out there for C#
This is awesome. Definently one of the better articles here at CodeProject. Just gotta say ‘thanks for sharing this with the rest of the world’...
I have been watching this control since 2007 and just checked the new features you’ve added recently and in the last couple of months. This has gotta be the best list control out there. You’ve done a brilliant job with this and I’m sure many others appreciate your work. Well done and keep it up!
I second that. This should be brought into the next version of the framework, it’s brillant work!
Superb job. Thanks for sharing this fantastic control.
Never think your work goes unappreciated. This is the best project on CodeProject, by far.
ObjectListView has got to be one of the slickest controls out there - simple, quick and powerful.
I’m using ObjectListView since one year now and it’s certainly one of the best ListView control I know.
I wanted to say that your control, your code, and your support on the forums, has been one of the best experiences I have had with working with someone elses’ product. Great job man, and very nice programming.
—Mike Coffey (in personal email)
Thanks for this control, which I now use everywhere I can! It works great.
Intelligent and Intuitive. Thanks.
One of the guys over at the MSDN magazine is known as the Datagrid (ASP.Net) whisperer. You must be the Listview whisperer. DAMN! This is a sexy bunch of controls!
What can I say? I have a file verification program, and I just replaced the listview with yours, and 150 lines of code was made obsolete, and very few lines were added, it also improved performance massively. The light shine upon you, MS should send you some sort of gift for removing the largest headache .NET ever contrived.
I’ve got to say, your code is amazing. It’s the only time in my life that I’ve looked at code and thought it was better than mine. Thanks for your great work (on many levels) and for sharing it.
—Brian Perrin (in personal email)
I think you should rename the control description to: “A ListView on Steroids”. Keep up the excellent work.
Nice features added, especially the fast build speed and hidden columns, keep up the good work on this control! well done.
A VERY BIG “Thank you” for this wonderful control - it’s easy to handle once you got the idea, very good structured coding, just a jewel. It became soon one of my favourites.
Great control. This solves a lot of problems. Thank you very much
Thanks for a GREAT control, and also for your help
I use this control in almost every project now.. amazing job. Thanks!
I’ve never posted before but this is so good, that I must say something... This is awesome!! Keep the good work!
Thank you for opening your hard work to the community, it saved me hours or coding plus I learnt a few new techniques from your code.
Those years of experience and innate talent certainly show in this code; it’s a pleasure to read. Thanks much for a great example.
Very nice article and worthy of bookmarking
That’s exactly what I have been finding for days. Thanks!!!
v2.6 will also move towards using IEnumerable whenever possible. SelectedObjects, CheckedObjects, AddObjects(), InsertObjects() RefreshObjects(), RemoveObjects(), and CopyObjectsToClipboard() will all be changed to use IEnumerable. This is with a view to using LINQ in future versions.
It will probably add a data bindable TreeListView.
v3.0 will be a big change. Until now, each version has strove to maintain strict backwards compatibility. v3.0 will not have this as a strict goal. It will be backwards compatible where possible, but will drop properties, events and methods where they do not fit within the new scheme. In particular, features that were a moment of design weakness (I’m looking at you AlwaysGroupByColumn and your friends) will disappear.
There is no definite timetable for these versions.