0

I am having issues getting more than one StackLayout to display in my UniformItemsLayout. I haven't changed my code since it was working, the only difference is I updated from some 1.X version to 3.1 and now only first child shows up if it is in a stacklayout.

<toolkit:UniformItemsLayout MaxColumns="2" >
            <StackLayout Orientation="Vertical">
                <Label Text="Test1"/>
                <Button Text="TestA"/>
            </StackLayout>
            <StackLayout Orientation="Vertical">
                <Label Text="Test2"/>
                <Button Text="TestB"/>
            </StackLayout>
            <StackLayout Orientation="Vertical">
                <Label Text="Test3"/>
                <Button Text="TestC"/>
            </StackLayout>
            <StackLayout Orientation="Vertical">
                <Label Text="Test4"/>
                <Button Text="TestD"/>
            </StackLayout>
            <StackLayout Orientation="Vertical">
                <Label Text="Test5"/>
                <Button Text="TestE"/>
            </StackLayout>
</toolkit:UniformItemsLayout>

When I test with just labels it seems to be fine but as soon as I add multiple stack layouts only the first one shows up.

Mufacka
  • 227
  • 1
  • 2
  • 11
  • Could I ask what platform you are testing on? I tested it on Windows with reference to your code, and it can be displayed normally in VS2022 17.4.2, but if `StackLayout` uses `Vertical`, its layout will look a bit strange, but it will display perfectly when using `Horizontal`. – Zack Jan 12 '23 at 02:52
  • I am working on Android mostly, but of course I'd love it to work great for all platforms as I plan to release my app on more than android. I will try it as horizontal - I'm on Version 17.5.0 Preview 2.0. I guess I'm always a sucker for updating to get the most features and fixes but at some point I guess I should just stop for the apps sake. – Mufacka Jan 13 '23 at 15:22
  • Same result with Stacklayouts with horizontal orientation on a brand new content page for Android. I even created a new maui project and added latest Nuget packages for CommunityToolkit and experiencing the same thing. I even tried to revert my Nuget package versions and project won't get back to how it was. Guess I'm out of luck on using this tool for now. – Mufacka Jan 15 '23 at 18:02

1 Answers1

0

I have created a new sample to test your code. I have tried the CommunityToolkit.Maui package from the version 1.0.0 to the version 3.1.0. None of the versions can show all the stacklayout in the UniformItemsLayout on the android.

And on the windows, it will show all the stacklayouts but the UI seems strange. But if you delete the StackLayout, all the controls will show. Such as:

<toolkit:UniformItemsLayout MaxColumns="2" >
         
                <Label Text="Test1"/>
                <Button Text="TestA"/>
           
                <Label Text="Test2"/>
                <Button Text="TestB"/>
           
                <Label Text="Test3"/>
                <Button Text="TestC"/>
            
                <Label Text="Test4"/>
                <Button Text="TestD"/>
            
                <Label Text="Test5"/>
                <Button Text="TestE"/>

</toolkit:UniformItemsLayout>

It should a bug on the android. You can reported it on the github.

Liyun Zhang - MSFT
  • 8,271
  • 1
  • 2
  • 14
  • I swear this was working previously maybe on a different preview build of Visual studio with version 1.3 for CommunityToolkit - I will look into reporting this as a bug. Thanks for the assistance/. – Mufacka Jan 17 '23 at 15:12