I have developed a screen for an app. When FlexLayout is the Content of the ContentPage the CollectionView expand to whole screen. Whereas when StackLayout is the Content of the ContentPage the CollectionView takes remaining space after adjusting all other views.
Run my sample and swap FlexLayout with StackLayout.
IDE: Visual Studio for Mac Preview
Affected Devices: iOS and Android
I think this is pretty consistent with our expectations. The CollectionView is meant to expand to its available vertical space. The StackLayout is meant to adjust the height of all items appropriately, so it effectively sets the height of its children. Thanks!
I think this is pretty consistent with our expectations. The CollectionView is meant to expand to its available vertical space. The StackLayout is meant to adjust the height of all items appropriately, so it effectively sets the height of its children. Thanks!
FlexLayout should also adjust the height of all items appropriately. It is not doing so. The problem is with FlexLayout.
I think this is pretty consistent with our expectations. The CollectionView is meant to expand to its available vertical space. The StackLayout is meant to adjust the height of all items appropriately, so it effectively sets the height of its children. Thanks!
Do we have any documentation stating this?. If so can you please update me the links? I don't see any information as you said in below documentation.
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/collectionview/
If you still consider this as a behavior, can we add this as a new feature request or an enhancement for some Xamarin controls to achieve this expected behavior (Refer the screenshot for ease)?
CollectionView should only take up the space needed to display the items, if we want to take up the entire screen we would specify this as we do with everything else.
This is still a bug in Xamarin.Forms 4.3 and has not been resolved. I used a StackLayout and Grid in the collection view and gave it a height yet I get a huge space I don't need from the CollectionView. The slider in the image below is supposed to be immediately after the collection View but I have this huge space. This is an urgent need for me. I have to deliver on this project soon.
Most helpful comment
CollectionView should only take up the space needed to display the items, if we want to take up the entire screen we would specify this as we do with everything else.