dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.98k stars 1.71k forks source link

Incorrect CollectionView height inside VerticalStackLayout #23359

Closed lucasbrahm closed 1 month ago

lucasbrahm commented 2 months ago

Description

With a CollectionView inside a VerticalStackLayout, it is expected that the CollectionView will grow with the remaining space available of the page and the itens of the collection should be scrollable.

But what is happening is that CollectionView is growing until the height size to display all itens, being this height greater than the page size, making it impossible to scroll to the last element.

Specifying the height (HeightRequest) of the CollectionView is a workaround, but I want it to grow with the remaining space.

Steps to Reproduce

  1. Create a page with a VerticalStackLayout and add CollectionView inside of it.
  2. Add a lot of itens the CollectionView (enough to need to be scrollable).
  3. As CollectionView grew greater than page height, it is not possible to scroll to the last element.

Link to public reproduction project repository

https://github.com/lucasbrahm/MauiTestBugVerticalStackLayoutCollectionView

Version with bug

8.0.61 SR6.1

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 13

Did you find any workaround?

Specifying the height (HeightRequest) of the CollectionView

Relevant log output

No response

github-actions[bot] commented 2 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

albyrock87 commented 2 months ago

Afaik VerticalStackLayout is supposed to grow indefinitely (it sets no vertical constraint on the children. To achieve what you probably want, a Grid must be used, or you can simply put the collection view as page content.

RoiChen001 commented 2 months ago

I can repro this issue at Android platform on the latest 17.11.0 Preview 2.1(8.0.61).

PureWeen commented 1 month ago

Duplicate of #24078