ObjectListView.NET ListView on caffeine, guarana and steroids. |
ObjectListView¶
ObjectListView is a C# wrapper around a .NET ListView. It makes the ListView much easier to use and teaches it some neat new tricks.
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.
I’m too impatient! Just show me what it can do!¶
Here is an example of what your ListView can look like with a few callbacks in place:
Put pretty graphics, buttons and descriptions on your list, to make your users love your application:
The TreeListView similarly make a tree structure look beautiful:
Need to print a report? ListViewPrinter effortlessly produces reports from an ObjectListView:
With a little work, you can even pretend to live in the halls of cool with something like this:
Without wasting my time, just tell me what it does!¶
OK, here’s the bullet point feature list:
- Automatically transforms a list of model objects into a fully functional ListView, including automatically sorting and grouping rows.
- Easily edit cell values.
- Easily use drag and drop.
- Supports all ListView views (report, list, large and small icons).
- Supports owner drawing, including rendering animated graphics and images stored in a database.
- Supports automatic grouping.
- Supports sophisticated group formatting, including collapsible groups (Vista and later only).
- Columns can be fixed-width, have a minimum and/or maximum width, or be space-filling (Column Widths)
- Displays a “list is empty” message when the list is empty (obviously).
- Supports fancy tooltips for cells and for headers.
- Supports buttons in cells.
- Supports checkboxes in any column as well as tri-state checkboxes.
- Supports hierarchical checkboxes in TreeListView.
- Supports alternate rows background colors.
- Supports custom formatting of rows.
- Supports searching (by typing) on any column.
- Supports image and text overlays as well as arbitrary decorations.
- Supports hyperlinks.
- Supports hot tracking with text font/color changes and with decorations.
- Supports column header formatting including checkboxes, word wrapping and vertical text.
- Supports groups on virtual lists (Vista and later only).
- Supports transluscent hot item and selection like Vista even on XP.
- Supports filtering, including the very common iTunes-like text filtering.
- Supports animations on cells, row, and the entire list.
- Supports column selection through right-click on header.
- Supports Excel-like column filtering.
- Supports native background images with all their inherent limitations.
- Supports disabled rows
- Supports automatic updates via standard INotifyPropertyChanged.
There are several flavours of ObjectListView:
- FastObjectListView can build a list of 10,000 objects in less than 0.1 seconds.
- TreeListView control combines an expandable tree structure with the columns of a ListView.
- There are data binding versions of each flavour.
Seriously, after using an ObjectListView, you will never go back to using a plain ListView.
OK, I’m interested. What do I do next?¶
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 it is still not obvious. The Forum section is the place to find all your as-yet- unasked questions.
It may even be possible that you might find some undocumented features in the code (also known as bugs). These “features” can be reported here and can be tracked on the project’s Issue Tracker.
If you would like to ask me a question or suggest an improvement, you can contact me here: phillip.piper@gmail.com.
Technical details¶
I’ve kept a technical blog documenting some of the efforts that were required to solve some of the problem encountered within the ObjectListView.
- Enabling disabling (20 May 2014)
- Creating hierarchical checkboxes (26 February 2014)
- Flickering on virtual lists and the .NET bug that causes it
- Lifting up the downtrodden ListViewGroup
- How can I make a rearrangeable TreeListView?
- Surely a little bug can’t cause too much trouble?
- This long article talks about the problems and solutions encountered when developing the overlay feature of v2.2.
- This article talks about the problems of trying to use a standard ToolTip class on a ListView.
Samples¶
This page of samples shows what can be done with a little effort. Use it for inspiration.
What people have said about 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.
—jake
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!!!
Future directions¶
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.
- Support for .NET 2.0 will be dropped. .NET 4.0 will become the minimum.
- Use 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.
- All styling (cell, header, tool tips) will be unified, and will include custom renderers and hit detection.
- General cleanup/refactor
There is no definite timetable for this version.