Xamarin.forms: [CollectionView] CollectionView Expands to full screen with FlexLayout

Created on 30 Mar 2019  路  5Comments  路  Source: xamarin/Xamarin.Forms

Description

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.

Steps to Reproduce

Run my sample and swap FlexLayout with StackLayout.

Basic Information

  • Version with issue: Xamarin.Forms-pre7
  • IDE: Visual Studio for Mac Preview

  • Affected Devices: iOS and Android

Reproduction Link

MyApp.zip

collectionview flex unverified bug

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.

All 5 comments

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.

view

Was this page helpful?
0 / 5 - 0 ratings