Discussion/Proposal: more ListViewGroup functionality
- Dominant language
- C#
- Stars
- 4.9k
- Forks
- 1.1k
- Avg merge
- 20h 23m
- Merged PRs (30d)
- 103
Description
# State of Play
- Currently, `ListViewGroup` only supports `Header` and `HeaderAlignment` (although this is buggy, see #2555)
- Our definition of `LVGROUPW` is actually too small: LVGROUP actually exposes a lot more functionality (https://docs.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-lvgroup)

# Missing Feature Parity
- See http://www.componentowl.com/better-listview.html
- See https://www.codeproject.com/Articles/16009/A-Much-Easier-to-Use-ListView-2
- See https://msdn.microsoft.com/en-gb/msdnmag/issues/07/08/WindowsCPP/default.aspx
## Support For Images
- You can set the `LVSIL_GROUPHEADER` list view image list
- You can set the `LVGF_TITLEIMAGE` flag on `mask` and set `iTitleImage` to a valid index into the `LVSIL_GROUPHEADER` image list
This would add the following APIs to `ListView` and `ListViewGroup`:
```cs
public class ListView
{
...
public ImageList GroupHeaderImageList { get; set; }
...
}
```
```cs
public class ListViewGroup
{
...
public int TitleImageIndex { get; set; }
...
}
```
E.g.

## Collapsible
- Can set the `LVGF_STATE` flag on `uMask` and set `stateMask` to `LVGS_COLLAPSIBLE` and `state` to `LVGS_COLLAPSIBLE`
- https://www.codeproject.com/Articles/31276/Add-Group-Collapse-Behavior-on-a-Listview-Control
This would add the following APIs to `ListViewGroup`:
```cs
public class ListViewGroup
{
...
public bool Collapsible { get; set; }
...
}
```
E.g.

### Discussion
- The rightmost collapse/expand icon doesn't work: to fix this we need to call `base.WndProc` in `WM_LBUTTONUP` handler
## Collapsed
- Can set the `LVGF_STATE` flag on `uMask` and set `stateMask` to `LVGS_COLLAPSED` and `state` to `LVGS_COLLAPSED`
This would add the following APIs to `ListViewGroup`:
```cs
public class ListViewGroup
{
...
public bool Collapsed { get; set; }
...
}
```
E.g.

## HeaderVisible
- Can set the `LVGF_STATE` flag on `uMask` and set `stateMask` to `LVGS_NOHEADER` and `state` to `LVGS_NOHEADER`
This would add the following APIs to `ListViewGroup`:
```cs
public class ListViewGroup
{
...
public bool HeaderVisible { get; set; } = true;
...
}
```
E.g.

## Description Top/Bottom
- You can set the `LVGF_DESCRIPTIONTOP` flag on `mask` and set `pszDescriptionTop` to a valid string and `cchDescriptionTop` to the length of the string
- You can set the `LVGF_DESCRIPTIONBOTTOM` flag on `mask` and set `pszDescriptionBottom` to a valid string and `cchDescriptionBottom` to the length of the string
This would add the following APIs to `ListViewGroup`:
```cs
public class ListViewGroup
{
...
public string TopDescription { get; set; }
public string BottomDescription { get; set; }
...
}
```
E.g.

/cc @weltkante @RussKie
Contributor guide
Assessment
This issue has not been assessed yet.