Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[CollectionView] CollectionView Expands to full screen with FlexLayout #5763

Closed
HobDev opened this issue Mar 30, 2019 · 8 comments
Closed

[CollectionView] CollectionView Expands to full screen with FlexLayout #5763

HobDev opened this issue Mar 30, 2019 · 8 comments
Labels
a/collectionview a/flex s/unverified New report that has yet to be verified t/bug 🐛

Comments

@HobDev
Copy link

HobDev commented Mar 30, 2019

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

@pauldipietro pauldipietro added this to New in Triage Mar 30, 2019
@samhouts samhouts added the s/unverified New report that has yet to be verified label Apr 9, 2019
@samhouts
Copy link
Member

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!

@HobDev
Copy link
Author

HobDev commented Apr 20, 2019

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.

@MeikandaNayanar
Copy link

MeikandaNayanar commented Jun 19, 2019

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)?

@EvoPulseGaming
Copy link

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.

@nwikechisom
Copy link

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

@BillyMartin1964
Copy link

This is extremely silly that you can't center a collectionview when you don't have enough items to fill the screen. Instead of saying it's designed that way... please fix it. How does anyone know ahead of time how may items the user will have. Ridiculous.

@Tuurash
Copy link

Tuurash commented Oct 20, 2021

@junedmmn
Copy link

junedmmn commented Apr 3, 2024

A recommendation: In short, when displaying a collection that does not expand on the whole screen use StackLayout's BindableLayout. Keep the collection minimal, and optimal, so it will only show a glimpse of the collection. Provide an option to expand this minimal collection that will show whole collection in its original form, display this using CollectionView on another page. But only use CollectionView when you desire to display collection on the whole page/screen.

CollectionView offers virtualization and optimizations on both iOS and Android, hence it does not calculate size of its children and expands to the whole page. Hence use CollectionView when you want to show large collection with complex layout or template. Like list of all records, entries or rows in your app.

Otherwise use StackLayout's BindableLayout to show small minimal collection/list like predictions for search entry, autocomplete, etc.

Hope this helps.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/collectionview a/flex s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

No branches or pull requests

8 participants