What’s New?Recent improvements in loving the ListView |
What’s New?Recent improvements in loving the ListView |
For the (mostly) complete change log, see here.
This release focused on formatting – giving programmers more opportunity to play with the appearance of the ObjectListView.
Decorations allow you to put pretty images, text and effects over the top of your ObjectListView. Here the love heart and the “Missing!” are decorations.
See this recipe 20. How can I put an image (or some text) over the top of a row or cell? for more details.
Groups have been overhauled for this release. Groups under XP remain unchanged, but under Vista and Windows 7, many more formatting options are now available.
See 27. How do I put an image next to a group heading? for how to make pretty groups like this.
The font and text color of the ObjectListView header can now be changed. You can also word wrap the header text.
See 25. How do I change the font or color of the column headers?.
In previous version, RowFormatter was the approved way to change the formatting (font/text color/background color) of a row or cell. But it had some limitations:
To get around all these problems, there is now a FormatRow event. This is called after the OLVListItem has been added to the control. Plus it has a DisplayIndex property specifying exactly where the row appears in the list (this is correct even when showing groups).
There is also a FormatCell event. This allows the programmer to easily format just one cell.
By using compiler attributes, ObjectListViews can now be generated directly from model classes. See 29. Can I generate the whole ObjectListView directly from my model? for details and provisos.
[Thanks to John Kohler for this idea and the original implementation]
When running on Vista and later, virtual lists can now be grouped!
FastObjectListView supports grouping out of the box. For your own VirtualObjectListView you must do some more work yourself.
See 31. Can I show groups on a virtual list? for details.
[This was more of a technical challenge for myself than something I thought would be wildly useful. If you do actually use groups on virtual lists, please let me know]
This is primarily a bug fix release.
The two big features in this version are overlays and drag and drop support.
ObjectListViews now have sophisticated support for drag and drop operations.
An ObjectListView can be made a source for drag operations by setting the DragSource property. Similarly, it can be made a sink for drop actions by setting the DropSink property. These properties accept an IDragSource interface and an IDropSink interface respectively. SimpleDragSource and SimpleDropSink provide reasonable default implementations for these interfaces.
Since the whole goal of ObjectListView is to encourage slothfulness, for most simple cases, you can ignore these details and just set the IsSimpleDragSource and IsSimpleDropSink properties to true, and then listen for CanDrop and Dropped events.
See ObjectListView and Drag & Drop for more details.
The RearrangeableDropSink class gives an ObjectListView the ability to be rearranged by dragging. See Rearranging rows by dragging.
ObjectListView now have the ability to draw translucent images and text over the top over the ObjectListView contents. These overlays do not scroll when the list contents scroll. These overlays works in all Views. You can set an overlays within the IDE using the OverlayImage and OverlayText properties.
The overlay design is extensible, and you can add arbitrary overlays through the AddOverlay() method.
See 19. How can I put an image (or some text) over the top of the ListView? for more details.
The “list is empty” message is now implemented as an overlay, and as such is heavily customisable. See 12. How do I change the message that’s shown when the ObjectListView is empty? for details.
In the same way that 2.0 overhauled the virtual list processing, this version completely reworks the owner drawn rendering process. However, this overhaul was done to be transparently backwards compatible.
The only breaking change is for owner drawn non-details views (which I doubt that anyone except me ever used). Previously, the renderer on column 0 was double tasked for both rendering cell 0 and for rendering the entire item in non-detail view. This second responsibility now belongs explicitly to the ItemRenderer property.
This version adds some small features and fixes some bugs in 2.0 release.
Version 2.0 is a major change to ObjectListView.