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

[Bug] [UWP] CollectionView ItemsLayout not working when initially invisible #9079

Closed
SuNNjek opened this issue Jan 3, 2020 · 10 comments · Fixed by #14593
Closed

[Bug] [UWP] CollectionView ItemsLayout not working when initially invisible #9079

SuNNjek opened this issue Jan 3, 2020 · 10 comments · Fixed by #14593

Comments

@SuNNjek
Copy link
Contributor

SuNNjek commented Jan 3, 2020

Description

I'm trying to use a CollectionView in UWP with a vertical grid layout. This CollectionView, however, is revealed through a user action and is initially invisible (IsVisible="False"). When this happens, the ItemsLayout seems to be ignored, as the CollectionView displays its items as a vertical list.

Steps to Reproduce

  1. Build and start the attached demo project
  2. Click the button at the top to reveal the CollectionView

Expected Behavior

The items are arranged as a vertical grid with 3 columns.

Actual Behavior

The items are arranged as a vertical list

Basic Information

  • Version with issue: 4.4.0.991265
  • Last known good version: -
  • IDE: Visual Studio 2019 Professional
  • Platform Target Frameworks:
    • iOS: -
    • Android: -
    • UWP: 16299
  • Android Support Library Version: -
  • Nuget Packages: -
  • Affected Devices: Windows 10 PC

Screenshots

The headers refer to the initial visibility of the CollectionView.

IsVisible="False" IsVisible="True"
collectionView1 collectionView2

Reproduction Link

UWPCollectionViewBug.zip

@SuNNjek SuNNjek added s/unverified New report that has yet to be verified t/bug 🐛 labels Jan 3, 2020
@pauldipietro pauldipietro added this to New in Triage Jan 3, 2020
@samhouts samhouts added this to Backlog in CollectionView Jan 3, 2020
@hartez hartez added e/3 🕒 3 and removed s/unverified New report that has yet to be verified labels Jan 9, 2020
@hartez hartez removed this from New in Triage Jan 9, 2020
@ElmellaliMobiArchitects

the same problem. :'( IOS

@SuNNjek
Copy link
Contributor Author

SuNNjek commented Jan 17, 2020

I've also noticed that the sample doesn't even launch on iOS when the CollectionView is initially invisible.

@VelizarGremori
Copy link

t works for me to put CollectionView into the zero size container.
For example, we do have the grid with 2 rows with zero and non zero height. Initially, put the CollectionView in to the row with zeroe height to make it invisible, then move it to the non zero height row to make it visible (using Grid.SetRow)
CollectionViewBugWorkaround.zip

@jhariel8
Copy link

I'm experiencing a similar issue when navigating away from the page and returning to it. The "IsVisible" property doesn't necessarily seem to affect it one way or the other.

I tried @VelizarGremori solution and it seemed like when setting the row back to the "nonzero" row, my collectionview would still have a height of zero, even if I changed the HeightRequest explicitly or changed layout options to FillAndExpand. Any ideas on why this might be?

@BioTurboNick
Copy link

Just wanted to +1 this and the related issues. I'm having to change the design of my app because CollectionView doesn't layout properly when it is made visible, and I can't find a reliable workaround. I hope your team will prioritize this set of issues.

@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@samhouts samhouts added this to To do in vNext+1 (5.0.0) Aug 14, 2020
@samhouts samhouts removed this from the 5.0.0 milestone Nov 2, 2020
@hartez hartez moved this from Review Backlog to Backlog in CollectionView Feb 6, 2021
@YuliaLoyko
Copy link

experiencing same issue: when set collectionview from invisible to visible state - it displays one column instead of 2

@hairatic
Copy link

hairatic commented May 17, 2021

Got similar problem on Xamarin Forms 4.8 on iOS. I use CollectionView with GridItemsLayout (Span = 2) inside Expander (long infographic screen with expandable sections).
But my result is even worse - app just FREEZES when I open up the page. Changing layout to Linear or expanding section at the start (IsExpanded = true in XAML) solves the problem.
I've tested it on 2 real devices and 2 simulators. Issue persists.
Android version works as expected.

@jrlaff
Copy link

jrlaff commented May 21, 2021

Any chance this being fixed? it is opened since January 2020 and it is very annoying, requiring to change the design of my app.

@BioTurboNick
Copy link

I'm guessing for a lot of these the solution is going to be the new cross platform UI framework, MAUI.

@jsuarezruiz
Copy link
Contributor

fix-9079
Soon in an upcoming SR.

CollectionView automation moved this from Backlog to Done Oct 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Development

Successfully merging a pull request may close this issue.