Description
This is a very similar issue to #28012 which that has been fixed for CollectionView.Header, the same issue occurs when trying to hide the content of a GroupHeaderTemplate.
When using a CollectionView with groups, once the cells have been rendered if you set the GroupHeaderTemplates root view visibility:IsVisible="False, the header cell's content dissapears but its height is not recalculated, leaving an empty space where the header content was.
This also affects height requests, once the cell has been rendered if you set a new HeightRequest, the cell's height will remain at whatever height it was rendered at.
I have supplied a fully coded reproduction, below are screenshots from this sample app of both how this actually behaves vs how I expect this to behave.
| Group Headers Visible |
Group Headers Hidden (Expectation) |
Group Headers Hidden (Reality) |
 |
 |
 |
Steps to Reproduce
- Create a grouped collection view
- Add a grouped header for the collection view
- Add a mechanism to toggle the visibility of the grouped header (ie a switch & binding
x:Reference)
- Run the app
- Toggle the visibility of the header from
true to false
Expectation:
The header cell content dissapears and the group header cell resizes, hiding the group header completely
Actual:
The header cell content dissapears but the cell remains the same height, leaving empty space where the group header was
Link to public reproduction project repository
https://github.com/Axemasta/MauiRepros/tree/main/src/GroupHeaderResizingRepro
Version with bug
9.0.90 SR9
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
Any
Did you find any workaround?
I have attempted to use triggers to set the HeightRequest to 0, however this only works when new group headers are rendered, it does not affect group headers which are currently being displayed therefore not much of a workaround.
Relevant log output
Description
When using a
CollectionViewwith groups, once the cells have been rendered if you set theGroupHeaderTemplates root view visibility:IsVisible="False, the header cell's content dissapears but its height is not recalculated, leaving an empty space where the header content was.This also affects height requests, once the cell has been rendered if you set a new
HeightRequest, the cell's height will remain at whatever height it was rendered at.I have supplied a fully coded reproduction, below are screenshots from this sample app of both how this actually behaves vs how I expect this to behave.
Steps to Reproduce
x:Reference)truetofalseExpectation:
The header cell content dissapears and the group header cell resizes, hiding the group header completely
Actual:
The header cell content dissapears but the cell remains the same height, leaving empty space where the group header was
Link to public reproduction project repository
https://github.com/Axemasta/MauiRepros/tree/main/src/GroupHeaderResizingRepro
Version with bug
9.0.90 SR9
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
Any
Did you find any workaround?
I have attempted to use triggers to set the
HeightRequestto 0, however this only works when new group headers are rendered, it does not affect group headers which are currently being displayed therefore not much of a workaround.Relevant log output