Skip to content

The header in a collectionview does not resize if you hide the content #28012

@acaliaro

Description

@acaliaro

Description

If I have a collectionview with a header and the header container control has the "IsVisible" property bound to a boolean property in the ViewModel, when the boolean property is set to "false", the header content disappears but the space does not compress.
If on the contrary, in addition to the container I also set the "IsVisible" property of the content (e.g. an Image), the header content disappears and the header space compresses

Steps to Reproduce

  • Create a page with a collectionview
  • In the collectionView insert a header with a VerticalStackLayout
  • In the VerticalStackLayout insert an image
  • Set the "IsVisible" property of the VerticalStackLayout in binding with a boolean in the ViewModel.
  • Use a Switch to set the boolean so as to display or not the image
  • The image disappears but the header space does not compress

Link to public reproduction project repository

https://github.com/acaliaro/MauiAppCollectionViewHeaderProblem

Version with bug

9.0.40 SR4

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android

Affected platform versions

iOS 18.2.1, Android 35

Did you find any workaround?

By setting the IsVisible of the image as well, the header resizes correctly

Relevant log output

Metadata

Metadata

Assignees

Labels

area-controls-collectionviewCollectionView, CarouselView, IndicatorViewt/bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions