Skip to content

[regression/7.0.0] FlexLayout not working after updateΒ #13074

Closed

Description

@edwardwhiteheaddev

Description

Prior to upgrading VS2022 Preview yesterday, the FlexLayout implemented in my code was working 100%. Since the changes, the FlexLayout does not render properly. Instead of displaying like a grid, it is now overlapped and displays in rows.

Steps to Reproduce

Create a new MAUI project and target only Android 13 (v33).
Replace the ContentPage with the exact code I tested with:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="MauiTestBench.MainPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">


 <ContentPage.Resources>
        <ResourceDictionary>
            <!--  Start Tile Styling  -->
            <Style x:Key="TileStyle" TargetType="Frame">
                <Setter Property="Padding" Value="0,0,0,0" />
                <Setter Property="Margin" Value="0,20,0,20" />
                <Setter Property="BorderColor" Value="LightBlue" />
                <Setter Property="CornerRadius" Value="15" />
                <Setter Property="HasShadow" Value="True" />
                <Setter Property="HeightRequest" Value="120" />
                <Setter Property="WidthRequest" Value="120" />
                <Setter Property="MinimumHeightRequest" Value="100" />
                <Setter Property="MinimumWidthRequest" Value="100" />
                <Setter Property="HorizontalOptions" Value="CenterAndExpand" />
                <Setter Property="VerticalOptions" Value="CenterAndExpand" />
            </Style>
            <Style x:Key="TileImageStyle" TargetType="Image">
                <Setter Property="HeightRequest" Value="50" />
                <Setter Property="WidthRequest" Value="50" />
                <Setter Property="Margin" Value="5" />
            </Style>
            <Style x:Key="TileLabelStyle" TargetType="Label">
                <Setter Property="FontAutoScalingEnabled" Value="True" />
                <Setter Property="FontSize" Value="Default" />
                <Setter Property="HorizontalTextAlignment" Value="Center" />
                <Setter Property="TextColor" Value="Black" />
                <Setter Property="TextTransform" Value="Uppercase" />
                <Setter Property="FontFamily" Value="QuicksandRegular" />
                <Setter Property="FontSize" Value="Small" />
            </Style>
            <!--  End Tile Styling  -->
        </ResourceDictionary>
    </ContentPage.Resources>
    <ScrollView>
        <FlexLayout
            x:Name="FlexTiles"
            AlignItems="Stretch"
            Direction="Row"
            JustifyContent="SpaceEvenly"
            VerticalOptions="Start"
            Wrap="Wrap">

            <!--  ROSTERS TILE  -->
            <Frame Style="{DynamicResource TileStyle}">
                <StackLayout HorizontalOptions="Center" VerticalOptions="Center">
                    <Image Style="{DynamicResource TileImageStyle}" />
                    <Label Style="{DynamicResource TileLabelStyle}" />
                </StackLayout>
            </Frame>

            <!--  ADVANCED TILE  -->
            <Frame Style="{DynamicResource TileStyle}">
                <StackLayout HorizontalOptions="Center" VerticalOptions="Center">
                    <Image Style="{DynamicResource TileImageStyle}" />
                    <Label Style="{DynamicResource TileLabelStyle}" />
                </StackLayout>
            </Frame>

            <!--  MY HOLIDAYS TILE  -->
            <Frame Style="{DynamicResource TileStyle}">
                <StackLayout HorizontalOptions="Center" VerticalOptions="Center">
                    <Image Style="{DynamicResource TileImageStyle}" />
                    <Label Style="{DynamicResource TileLabelStyle}" />
                </StackLayout>
            </Frame>

            <!--  EMPLOYEE PAY TILE  -->
            <Frame Style="{DynamicResource TileStyle}">
                <StackLayout HorizontalOptions="Center" VerticalOptions="Center">
                    <Image Style="{DynamicResource TileImageStyle}" />
                    <Label Style="{DynamicResource TileLabelStyle}" />
                </StackLayout>
            </Frame>

            <!--  RUNSHEET TILE  -->
            <Frame Style="{DynamicResource TileStyle}">
                <StackLayout HorizontalOptions="Center" VerticalOptions="Center">
                    <Image Style="{DynamicResource TileImageStyle}" />
                    <Label Style="{DynamicResource TileLabelStyle}" />
                </StackLayout>
            </Frame>

            <!--  SOS TILE  -->
            <Frame Style="{DynamicResource TileStyle}">
                <StackLayout HorizontalOptions="Center" VerticalOptions="Center">
                    <Image Style="{DynamicResource TileImageStyle}" />
                    <Label Style="{DynamicResource TileLabelStyle}" />
                </StackLayout>
            </Frame>

            <!--  SMARTFORMS TILE  -->
            <Frame Style="{DynamicResource TileStyle}">
                <StackLayout HorizontalOptions="Center" VerticalOptions="Center">
                    <Image Style="{DynamicResource TileImageStyle}" />
                    <Label Style="{DynamicResource TileLabelStyle}" />
                </StackLayout>
            </Frame>

            <!--  MY MESSAGES TILE  -->
            <Frame Style="{DynamicResource TileStyle}">
                <StackLayout HorizontalOptions="Center" VerticalOptions="Center">
                    <Image Style="{DynamicResource TileImageStyle}" />
                    <Label Style="{DynamicResource TileLabelStyle}" />
                </StackLayout>
            </Frame>

            <!--  EMAIL CONTROL ROOM TILE  -->
            <Frame Style="{DynamicResource TileStyle}">
                <StackLayout HorizontalOptions="Center" VerticalOptions="Center">
                    <Image Style="{DynamicResource TileImageStyle}" />
                    <Label Style="{DynamicResource TileLabelStyle}" />
                </StackLayout>
            </Frame>

            <!--  CALL CONTROL ROOM TILE  -->
            <Frame Style="{DynamicResource TileStyle}">
                <StackLayout HorizontalOptions="Center" VerticalOptions="Center">
                    <Image Style="{DynamicResource TileImageStyle}" />
                    <Label Style="{DynamicResource TileLabelStyle}" />
                </StackLayout>
            </Frame>

            <!--  LOGOFF TILE  -->
            <Frame Style="{DynamicResource TileStyle}">
                <StackLayout HorizontalOptions="Center" VerticalOptions="Center">
                    <Image Style="{DynamicResource TileImageStyle}" />
                    <Label Style="{DynamicResource TileLabelStyle}" />
                </StackLayout>
            </Frame>
        </FlexLayout>
    </ScrollView>

</ContentPage>

Run the demo and you should see the above frames are displayed in a stacked format.

This has been tested on VS2022 17.4.4 and the Preview version is 17.5

Link to public reproduction project repository

n/a

Version with bug

7.0 (current)

Last version that worked well

7.0 (current)

Affected platforms

Android

Affected platform versions

Android 13

Did you find any workaround?

Grab the nuget from here
https://www.nuget.org/packages/PureWeen.Maui.FixesAndWorkarounds

#if ANDROID
            builder.ConfigureMauiHandlers(handlers =>
            {
                handlers.AddHandler(typeof(Frame), typeof(WorkaroundFrameRenderer));
            });
#endif

or

            builder.ConfigureMauiWorkarounds();

Relevant log output

No response

Activity

  1. added
    t/bug
    on Feb 2, 2023
  2. added
    area-layout
    layout-flex
    i/regression
    on Feb 2, 2023
  3. added this to the Backlog milestone on Feb 2, 2023
  4. edwardwhiteheaddev commented on Feb 7, 2023

    @edwardwhiteheaddev
    Author

    It is important to note that I have tested this code on another machine and I get the very same result, so something has happened between the previous version where the FlexLayout was working to the new version released.

  5. self-assigned this
    on Feb 14, 2023
  6. added a commit that references this issue on Feb 14, 2023
    df88d32
  7. moved this from Todo to In Progress in MAUI SDK Ongoingon Feb 14, 2023
  8. jerry08 commented on Feb 15, 2023

    @jerry08

    I just experienced this after updating. As a workaround, use Border instead of Frame. I find that the Frame control has many issues.

  9. edwardwhiteheaddev commented on Feb 16, 2023

    @edwardwhiteheaddev
    Author

    @jerry08 - thank you for this. It definitely is Frame and not FlexLayout.

  10. 4 remaining items

  11. added 2 commits that reference this issue on Feb 21, 2023
    2183145
    588bdfd
  12. added
    fixed-in-8.0.0-preview.1.7762
    on Feb 22, 2023
  13. modified the milestones: Backlog, 8.0-preview1 on Feb 22, 2023
  14. added a commit that references this issue on Feb 23, 2023
    ddcb71f
  15. added
    fixed-in-7.0.81
    on Apr 12, 2023
  16. ghost locked as resolved and limited conversation to collaborators on May 12, 2023
  17. changed the title [-]FlexLayout not working after update[/-] [+][regression/7.0.0] FlexLayout not working after update[/+] on Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-layoutfixed-in-7.0.100fixed-in-7.0.101fixed-in-7.0.81fixed-in-8.0.0-preview.1.7762i/regressionlayout-flexplatform/androidt/bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions