ListView - where are the group headers?

  • Thread starter Thread starter Jon Shemitz
  • Start date Start date
J

Jon Shemitz

I have a 2.0 ListView I'm using in grouped mode. It looks just fine,
but: Is there any way to find where the the group headers are?

I use HitTest() in a mouse-down handler, and get
ListViewHitTestInfo.Location = "None" when I click on a group header
.....
 
Do you wish to capture a group click?

That could be hard to do. Why not acces the group property of selected
item?
 
Do you wish to capture a group click?

Basically.
That could be hard to do. Why not acces the group property of selected
item?

Well, because the click might be on a header, and not affect the
selected item.

I faked it.

I wrote a routine that calculates a ListViewGroup's Rectangle - the
smallest Rectangle that contains all Items in the group. Then I wrote
a routine that foreachs through the groups, looking for the first one
whose bottom is below the click point.

That's perhaps close enough for "zoom to group" behavior. If I wanted
to zoom only when I clicked on the header (not, say, to the left or
right of the group rectangle, and not on white space between items) I
could check that the click location is indeed above the group
rectangle.
 
Back
Top