dotnet/winforms

Discussion/Proposal: more ListViewGroup functionality

Open

#2623 aperta il 3 gen 2020

Vedi su GitHub
 (8 commenti) (4 reazioni) (2 assegnatari)C# (922 fork)batch import
api-suggestionarea-controls-ListViewhelp wantedinvestigatetenet-compatibility-OS

Metriche repository

Star
 (4100 star)
Metriche merge PR
 (Merge medio 14g 22h) (56 PR mergiate in 30 g)

Descrizione

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

Guida contributor