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
22.06k stars 1.73k forks source link

BindableLayout not showing up items for the first time #13577

Open Strypper opened 1 year ago

Strypper commented 1 year ago

Description

This is a weird scenario and I can't get my head around to find out what went wrong. I open up my app and navigate to the GalleryPage and I saw nothing load fed the HorizontalWrapLayout items image When I navigate to another places navigate to the GalleryPage all items are fully loaded to the HorizontalWrapLayout image At first, I thought something was wrong with my logic provider providing wrong data or something, unfortunately, none of those are the root cause, I quickly remember what recently changed on this page and there's only one on the UI is that the HorizontalWrapLayout is being wrapped inside a Frame, I was very hopeless since there's no way have anything to do with my controls list but I did remove it and shockingly everything is back to normal ???? is the Frame somehow related to this? image

Bug reporting is hard and time-consuming, I have no intention of creating hard work for you guys but in this case, I think the best to do an investigation to use my application and test it out on my repository

Steps to Reproduce

  1. Clone or pull down mauisland repo
  2. The project will give you an error that is not related to this issue, it just says that you are missing an appsettings.Development.json file in the project (we can't include this file on our repo because it contains our private Synsfusion Key) but you just create a match file name input this content to the file and application will happy to run

    appsettings.Development.json

    {
    "AppSettings": {
    "SyncfusionKey": "key"
    }
    }
  3. Once that's done the project is ready for running please navigate to the GalleryPage.xaml and uncomment these line of code image
  4. Run the project and navigate to the gallery image
  5. You will there's no items are being displayed just an empty square box image
  6. When you navigate back to home and renavigate to the gallery page again you will all the items are being loaded up image
  7. After that you might have something to do with the itemssource but it's not, go back to the code and undo the comment step to reactive the Frame and rerun the project again - Everything is working as expected! image

Are somehow the Framecontrol related to this situation? this not only Windows but also Android

Link to public reproduction project repository

https://github.com/Strypper/mauisland

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android, Windows

Affected platform versions

Windows 11 Android 11

Did you find any workaround?

Remove the Frame

Relevant log output

None
ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

angelru commented 1 year ago

@Strypper Something similar or the same thing happens to me, I think it's the bindablelayout, look at my sample. I haven't found a solution yet #13868

angelru commented 1 year ago

Any alternative how to fix this?

Strypper commented 1 year ago

Any alternative how to fix this?

Hi angelru I haven't found a way yet, I have to changed the frame into border

angelru commented 1 year ago

Any alternative how to fix this?

Hi angelru I haven't found a way yet, I have to changed the frame into border

I have a border and it keeps happening to me, at least on android:

https://github.com/angelru/ValdemoroEn1/blob/main/src/ValdemoroEn1/Features/Menu/Movies/MoviesPage.xaml#L69

Strypper commented 1 year ago

Currently I don't have laptop with me I will have a look when I get home

angelru commented 1 year ago

I have to change to a horizontal collectionview but this is not optimal since I have a vertical collectionview as parent...

jinxinjuan commented 1 year ago

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 1.0. Can repro on windows platform with sample project. Not repro on Android platform https://github.com/Strypper/mauisland

baaaaif commented 1 year ago

I had a similar problem After a very, very long time of finding a solution, I finally found a workaround. Maybe that works in this case too

`public class FixedVerticalStackLayout : VerticalStackLayout {

public FixedVerticalStackLayout():base()
{

}

protected override void OnAdd(int index, IView view)
{
    base.OnAdd(index, view);

if ANDROID

    Dispatcher.Dispatch(InvalidateMeasure);

endif

}

}`

angelru commented 7 months ago

I had a similar problem After a very, very long time of finding a solution, I finally found a workaround. Maybe that works in this case too

`public class FixedVerticalStackLayout : VerticalStackLayout {

public FixedVerticalStackLayout():base()
{

}

protected override void OnAdd(int index, IView view)
{
  base.OnAdd(index, view);

if ANDROID Dispatcher.Dispatch(InvalidateMeasure); #endif } }`

It seems to work... you have to be with these things...

albyrock87 commented 4 months ago

If that workaround works, I guess this will fix it #23052

mackayn commented 2 months ago

I had a similar problem After a very, very long time of finding a solution, I finally found a workaround. Maybe that works in this case too

`public class FixedVerticalStackLayout : VerticalStackLayout {

public FixedVerticalStackLayout():base()
{

}

protected override void OnAdd(int index, IView view)
{
  base.OnAdd(index, view);

if ANDROID Dispatcher.Dispatch(InvalidateMeasure); #endif } }`

Works really well, thanks. Just ran into this issue. Stuff like layouts are pretty fundamental. Android was just drawing over the 1st cell and iOS showed nothing.

angelru commented 2 months ago

When will this be fixed without having to apply the workaround?