Puneet Sharma
Puneet Sharma

Reputation: 103

Flex Layout in Xamarin

I user flex in my every project on html and css. I find in XAML <flexlayout work same kind of so I try

<ContentPage.Content>
        <StackLayout>
            <FlexLayout>
                <FlexLayout>
                    <Label Text="It don't work"></Label>
                </FlexLayout>
                <Label Text="Is it work"></Label>
               
            </FlexLayout>
        </StackLayout>
    </ContentPage.Content>

which don't show any flex inside flex so nothing in it but i can see it work stuff. What is i am doing wrong here kind of still new in xarmarin/xaml

Microsoft doc are kind of basic also https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/layouts/flex-layout

Upvotes: 0

Views: 1052

Answers (1)

Cherry Bu - MSFT
Cherry Bu - MSFT

Reputation: 10346

I find one thread at github to discuss about nested FlexLayout is not visible:

https://github.com/xamarin/Xamarin.Forms/issues/9537.

I also find one workaround that you can place your child flex layout inside it will work:

<StackLayout>
        <FlexLayout>
            <StackLayout WidthRequest="100">
                <FlexLayout>
                    <Label Text="It don't work" />
                </FlexLayout>
            </StackLayout>
            <Label FlexLayout.AlignSelf="Center" Text="Is it work" />
        </FlexLayout>
    </StackLayout>

enter image description here

Upvotes: 2

Related Questions