dotnet/winforms

Discussion/Proposal: more ListViewGroup functionality

Open

#2,623 建立於 2020年1月3日

在 GitHub 查看
 (8 留言) (4 反應) (2 負責人)C# (922 fork)batch import
api-suggestionarea-controls-ListViewhelp wantedinvestigatetenet-compatibility-OS

倉庫指標

Star
 (4,100 star)
PR 合併指標
 (平均合併 14天 22小時) (30 天內合併 56 個 PR)

描述

State of Play

Missing Feature Parity

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:

public class ListView
{
    ...
    public ImageList GroupHeaderImageList { get; set; }
    ...
}
public class ListViewGroup
{
    ...
    public int TitleImageIndex { get; set; }
    ...
}

E.g. image

Collapsible

This would add the following APIs to ListViewGroup:

public class ListViewGroup
{
    ...
    public bool Collapsible { get; set; }
    ...
}

E.g. Screen Recording 2020-01-03 at 08 10 pm

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:

public class ListViewGroup
{
    ...
    public bool Collapsed { get; set; }
    ...
}

E.g. Screen Recording 2020-01-04 at 06 57 pm

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:

public class ListViewGroup
{
    ...
    public bool HeaderVisible { get; set; } = true;
    ...
}

E.g. Screen Recording 2020-01-04 at 07 05 pm

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:

public class ListViewGroup
{
    ...
    public string TopDescription { get; set; }
    public string BottomDescription { get; set; }
    ...
}

E.g. image

/cc @weltkante @RussKie

貢獻者指南