Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CollectionView is positioned incorrectly and the scrolling is broken #6784

Closed
holecekp opened this issue May 3, 2022 · 3 comments
Closed
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/android 🤖 platform/windows 🪟 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@holecekp
Copy link

holecekp commented May 3, 2022

Description

CollectionView behaves differently than ListView in MAUI - it is positioned incorrectly and the scrolling does not work.

I have made a sample repro project with a page that has a label on the top, followed by a CollectionView and there is another label on the bottom. This page is not rendered correctly. The label on the bottom is not visible. Moreover, only first items are shown in the CollectionView, which cannot be scrolled down to show the rest of the items.

There is another page in the repro project that uses a ListView instead of CollectionView. This page is displayed correctly.

ListView (displayed correctly, the red label on the bottom is visible):
mauilistviewwindows

CollectionView (displayed incorrectly, it covers the red label and it cannot be scrolled)
mauicollectionviewwindows

Moreover, the CollectionView page rendering is extremely slow (and the CollectionView has only 100 items). This is especially striking when you are on the ListView page in the repro project and then you select the CollectionView page from the flyout menu.

Steps to Reproduce

  1. Download the repro project: https://github.com/holecekp/MauiCollectionView
  2. Run it on Windows (but the bug is also on Android)
  3. The page with the CollectionView is displayed. There should be 100 items. Only first items are displayed instead and it is impossible to scroll down to view the rest of the items. There should be a red label on the bottom of the screen, but it is not visible and the CollectionView covers it.
  4. Open the flyoutmenu and select the second item. It leads to the similar page but it uses a ListView instead. Everything is displayed correctly there. The ListView can be scrolled down to the last of the items. The red label on the bottom of the page is visible.
  5. Switch back to the first page with the CollectionView. It takes a long time to load (the same on Android). Switching between these two pages very quickly (it is easier when you set the Shell.FlyoutBehavior="Locked") can crash the app with a COMException, but this is a different bug.

Version with bug

Release Candidate 2 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows, I was not able test on other platforms

Affected platform versions

Android 10 emulator, Windows 10

Did you find any workaround?

Use a ListView instead of CollectionView if you do not need functions specific to CollectionView. Otherwise, there is no workaround.

Relevant log output

No response

@holecekp holecekp added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels May 3, 2022
@Eilon Eilon added the area-controls-collectionview CollectionView, CarouselView, IndicatorView label May 3, 2022
@Redth
Copy link
Member

Redth commented May 3, 2022

The simple workaround here is to use a grid with 3 rows...

@hartez thoughts?

@Redth Redth added s/verified Verified / Reproducible Issue ready for Engineering Triage and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels May 3, 2022
@Redth Redth added this to the 6.0.300-servicing milestone May 3, 2022
@holecekp
Copy link
Author

holecekp commented May 3, 2022

I have found out meanwhile that I have forgotten to set VerticalOptions="FillAndExpand" for the CollectionView/ListView. After setting it, it works as expected for both controls. But it is still strange that the controls behaves differently without it.

@rmarinho
Copy link
Member

rmarinho commented Jun 2, 2022

This is by design using the Stacklayout will stretch it's content, you should use Grid, this is a change from Xamarin.Forms

@rmarinho rmarinho closed this as completed Jun 2, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView platform/android 🤖 platform/windows 🪟 s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants