When clicking on a ListView’s Group Header in XP, nothing happens.
When clicking on a ListView’s Group Header in Windows 7, all items in this group are selected.
I cannot test on Windows Vista as I do not have a machine.
How can one disable the “Select All” by clicking on the Group Header introduced in Windows 7 (or maybe Vista).
The user should still be allowed to select multiple or even all the items if they wish, just not via clicking the Group Header.
Answers which don’t suggest using alternative ListViews (e.g. ObjectListView) would be appreciated!
I am not using WPF.
Update
I tried, as a test, in the mouse-up event of the ListView adding a hit test to see if the group-header was being clicked and if it is to deselect all items.
When running in XP, this performs the desired effect. In Windows 7, it still selects all the items in that group!
Update 2
Solution found: see my answer.
I’ve figured it out.
Hopefully somebody will find this useful –
In this thread on MSDN, somebody was trying to create an event for clicking on a group header. I have re-appropriated this for my purposes as follows (see link for how functions and constants are defined):
This allows clicks to be recognised unless one clicks on the Group Header. If you want to perform some extra functionality, at
//*you could place an event, etc.Use a
switchonm.Msginstead of usingifif you require moreWndProcfunctionality.