docs-maui icon indicating copy to clipboard operation
docs-maui copied to clipboard

CollectionView does not display grouped data header by default

Open sethrhod opened this issue 1 year ago • 1 comments

Type of issue

Code doesn't work

Description

When passing in a collection of group items with name attributes as the CollectionView ItemsSource, the names are not displayed as the header by default like it says in the documentation. A GroupHeaderTemplate must be made and the Name attribute must be passed into it for the header to be displayed. image

With GroupHeaderTemplate image

Without GroupHeaderTemplate image

Page URL

https://learn.microsoft.com/en-us/dotnet/maui/user-interface/controls/collectionview/grouping?view=net-maui-8.0

Content source URL

https://github.com/dotnet/docs-maui/blob/main/docs/user-interface/controls/collectionview/grouping.md

Document Version Independent Id

56201296-c616-f9e0-bf20-e44931abe815

Article author

@davidbritch

Metadata

  • ID: 56201296-c616-f9e0-bf20-e44931abe815
  • Service: dotnet-mobile
  • Sub-service: dotnet-maui

sethrhod avatar Jan 19 '24 20:01 sethrhod

Hi @sethrhod

I'd say that the note is accurate.

Given a CollectionView that doesn't define a GroupHeaderTemplate:

    <StackLayout Margin="20">
        <CollectionView ItemsSource="{Binding Animals}"
                        IsGrouped="true" />
    </StackLayout>

The group header displays the name (iOS screenshot shown, but the same behavior occurs on Android):

image

davidbritch avatar Jan 29 '24 16:01 davidbritch