[Mono-winforms-list] desirable feature for MWF.ListView

Jonathan Gilbert 2a5gjx302 at sneakemail.com
Sat Nov 5 14:48:16 EST 2005


Hello,

I've heard that there is a plan in the works to rewrite the MWF ListView
control at some point. There is a feature I'd like to be included, if it's
possible (I don't know if it is). Basically, there's no proper way in the
.NET control to detect changes in the 'Items' collection. This would
generally be useful to people who want to make subclasses and attach their
own data or processing to list items. After some searching, I found a
Microsoft MVP post on a newsgroup advising a person to override the WndProc
function in his subclass of ListView and handle the LVM_INSERTITEM and
LVM_DELETEITEM messages. In addition, the .Clear() method sends the
LVM_DELETEALLITEMS message. I tried this technique out on Windows with
Microsoft's .NET and it works nicely with the following definitions:

    const int LVM_FIRST = 0x1000;

    const int LVM_UNICODE = 70;

    const int LVM_INSERTITEM      = LVM_FIRST + 7 + LVM_UNICODE;
    const int LVM_DELETEITEM      = LVM_FIRST + 8;
    const int LVM_DELETEALLITEMS  = LVM_FIRST + 9;

So, if possible, I think it'd be good for the ListView Items collection to
give these events to its ListView control when items are added and removed.
This is likely to be what anybody who wants these notifications will be using.

I can try to put together a patch for the existing ListBox if anyone is
interested.

Comments?

Jonathan Gilbert


More information about the Mono-winforms-list mailing list