maui
maui copied to clipboard
Flex Layout -> BindableLayout not working after ItemsSource changed in new vs preview version
Description
Repo that duplicates the bug (It's happend with observable collection / List / Ienumerable ...)
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
- Create Maui Project
- Add Flex layout with bindinglayout.ItemsSource = "any list"
- 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
-
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:
Screenshot of the incorrect layout in MAUI:
Same here not working flex out even with simple List collection
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
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>
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.
Verified this issue with Visual Studio Enterprise 17.7.0 Preview 4.0. Not repro on android platform with sample project. Repo