maui icon indicating copy to clipboard operation
maui copied to clipboard

Flex Layout -> BindableLayout not working after ItemsSource changed in new vs preview version

Open LeanTolo opened this issue 2 years ago • 3 comments

Description

Repo that duplicates the bug (It's happend with observable collection / List / Ienumerable ...)

Repo

bug

Im working on another project (and yesterday update vs preview to last version) and all data dissapear.

I try to reproduce it in the most simple way that i have. I'm doing something wrong?

Steps to Reproduce

  1. Create Maui Project
  2. Add Flex layout with bindinglayout.ItemsSource = "any list"
  3. Add Data to the List

Version with bug

6.0.400

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 12.0 - API 31 // Android 13.0 - API 33

Did you find any workaround?

Rollback to a VS 17.1.0

Relevant log output

-

LeanTolo avatar Aug 19 '22 12:08 LeanTolo

I have a very similar problem with FlexLayout. I wanted to create a new issue for it but then I found out this one, which has probably the same cause. In my case, FlexLayout does not work when I simply set ItemsSource in code (without need to do any subsequent modifications).

I have created a repro project for it. There should be two lines with buttons (A, B, C, D, E, F). Everything is displayed correctly in Xamarin.Forms. However, MAUI displays only the second line (buttons D, E, F only) and the first line is hidden on Android. Moreover, the second line collides with other controls on the page. The situation is even worse on Windows. The app crashes there (already reported https://github.com/dotnet/maui/issues/9905).

Link to my repro project: https://github.com/holecekp/MauiBugFlexLayout

Screenshot of the correct layout in Xamarin.Forms: MauiBugFlexAndroidXamarin

Screenshot of the incorrect layout in MAUI: MauiBugFlexAndroid

holecekp avatar Oct 05 '22 04:10 holecekp

Same here not working flex out even with simple List collection

raylight75 avatar Feb 27 '23 12:02 raylight75

Hitting a similar issue with using a Bindable layout in tandem with flex-layout. Creating a <FlexLayout BindableLayout.ItemsSource="{Binding SomeItems}"> .... breaks.

Running this code will break on Windows and not do anything on Android. It seems this is a somewhat known issue? The tutorials also have commented out similar code: https://github.com/dotnet/maui-samples/blob/main/6.0/UserInterface/Layouts/BindableLayoutDemos/BindableLayoutDemos/Views/UserProfilePage.xaml#L136-L140

jknaudt21 avatar Mar 09 '23 22:03 jknaudt21

Same issue. Only happens when setting ListView with DataSource. Workaround to set width/height posted in https://github.com/dotnet/maui/issues/9905, works, which suggests related layout issue.

    <FlexLayout
        Direction="Column"
        JustifyContent="SpaceBetween"
        >
        <StackLayout>
            <Label
                BackgroundColor="DarkOrange"
                HeightRequest="10"
            >
                
            </Label>
            <Image Margin="5"
               Source="./dotnet_bot_presenting.png"
               HeightRequest="140" />
            <Label>History</Label>
            <ListView x:Name="Colors" ItemsSource="{x:Static local:NamedColor.All}">
            </ListView>
        </StackLayout>
</FlexLayout>

chrisparnin avatar Mar 23 '23 12:03 chrisparnin

Hi @LeanTolo. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost avatar Jul 27 '23 06:07 ghost

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 4.0. Not repro on android platform with sample project. Repo

Zhanglirong-Winnie avatar Jul 27 '23 06:07 Zhanglirong-Winnie