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

[Bug] In a UWP AppShell app, using a CollectionView within a StackLayout along with a solitary label gives a blank screen. #12009

Open
davefxy opened this issue Sep 2, 2020 · 6 comments
Labels
a/collectionview a/layout in-progress This issue has an associated pull request that may resolve it! p/UWP t/bug 🐛
Projects
Milestone

Comments

@davefxy
Copy link

davefxy commented Sep 2, 2020

Description

In a UWP AppShell app, using a CollectionView within a StackLayout along with a solitary label gives a blank screen.

Steps to Reproduce

  1. I took the the xamarin xaminals sample app
  2. I edited the CatsPage.xaml adding a couple of lines like so:
    <StackLayout> <!--<Button Text="Test Button" ImageSource="bear.png" HorizontalOptions="Center" BackgroundColor="Red"/>--> <Label Text="Test" HorizontalOptions="Center" /> <CollectionView Margin="20" ItemsSource="{x:Static data:CatData.Cats}" ItemTemplate="{StaticResource AnimalTemplate}" SelectionMode="Single" SelectionChanged="OnCollectionViewSelectionChanged" /> </StackLayout>
  3. Run the modified sample, in the xaminals sample the 1st screen displayed is CatsPage.xaml. The content is black. If you uncomment the Button control, run again, the page is displayed as expected.

Basic Information

This was tested on a Windows PC using Visual Studio 2019 Version 16.7.2, Xamarin Forms v4.8.0.1364.

Screenshots

Without Button
With Button

Reproduction Link

Workaround

@davefxy davefxy added s/unverified New report that has yet to be verified t/bug 🐛 labels Sep 2, 2020
@samhouts samhouts added this to New in Triage Sep 2, 2020
@davefxy davefxy changed the title [Bug] In a UWP AppShell app, using a CollectionView within a StackLayout along with a label gives a blank content page. [Bug] In a UWP AppShell app, using a CollectionView within a StackLayout along with a solitary label in the gives a blank screen. Sep 2, 2020
@davefxy davefxy changed the title [Bug] In a UWP AppShell app, using a CollectionView within a StackLayout along with a solitary label in the gives a blank screen. [Bug] In a UWP AppShell app, using a CollectionView within a StackLayout along with a solitary label gives a blank screen. Sep 2, 2020
@bmacombe
Copy link
Contributor

bmacombe commented Sep 2, 2020

@davefxy If you resize the window does it then display?

If so might be related to #8814

@davefxy
Copy link
Author

davefxy commented Sep 2, 2020 via email

@davefxy
Copy link
Author

davefxy commented Sep 2, 2020 via email

@bmacombe
Copy link
Contributor

bmacombe commented Sep 2, 2020

@davefxy It's a layout timing issue when the CollectionView's item source is set.

PR #11394 is in review to fix.

@samhouts samhouts added the in-progress This issue has an associated pull request that may resolve it! label Sep 3, 2020
@samhouts samhouts added this to In Progress in vNext+1 (5.0.0) Sep 3, 2020
@hartez hartez added a/collectionview a/layout p/UWP and removed s/unverified New report that has yet to be verified labels Sep 3, 2020
@hartez hartez removed this from New in Triage Sep 3, 2020
@samhouts samhouts added this to the 5.0.0 milestone Sep 8, 2020
@PureWeen PureWeen self-assigned this Nov 2, 2020
@PureWeen PureWeen modified the milestones: 5.0.0, 5.0.1 Nov 2, 2020
@PureWeen PureWeen removed this from In Progress in vNext+1 (5.0.0) Nov 2, 2020
@PureWeen PureWeen added this to To do in v5.0.1 via automation Nov 2, 2020
@samhouts samhouts added this to In Progress in vNext+1 (5.0.0) Nov 2, 2020
@PureWeen PureWeen removed their assignment Nov 5, 2020
@PureWeen PureWeen removed this from In Progress in vNext+1 (5.0.0) Nov 5, 2020
@samhouts samhouts added this to In Progress in vNext+1 (5.0.0) Nov 5, 2020
@PureWeen PureWeen removed this from In Progress in vNext+1 (5.0.0) Nov 5, 2020
@hartez
Copy link
Contributor

hartez commented Dec 4, 2020

Why does having a button in stacklayout have the same effect as the window resize?

My guess is that it's an image button, and the image loading is async. So once the image has loaded, the button resizes and causes a re-layout; essentially the same thing that's happening when you resize the window.

@hartez
Copy link
Contributor

hartez commented Dec 4, 2020

This and #8814 do indeed appear to be the same problem. It's something specific to Shell, and possibly related to the timing things we fixed in #12017.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/collectionview a/layout in-progress This issue has an associated pull request that may resolve it! p/UWP t/bug 🐛
Projects
v5.0.1
To do
5 participants