Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why nested FlexLayout is not visible in this case?

Code:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:FlexLayout2"
             x:Class="FlexLayout2.MainPage">

    <FlexLayout
        Direction="Column"
        JustifyContent="Start"
        AlignItems="Stretch">
        <FlexLayout
            Direction="Row"
            JustifyContent="Start"
            AlignItems="Stretch">
            <BoxView Color="Red"/>
            <BoxView Color="Black"/>
        </FlexLayout>

        <BoxView Color="Yellow"/>

    </FlexLayout>

</ContentPage>

What I got: Image

What I expected: Image

Question says it all. What I am missing ?

Xamarin Forms 3.2

like image 765
Bojan Malinić Avatar asked Oct 17 '22 12:10

Bojan Malinić


1 Answers

If you place your child flex layout inside <ContentView> it will work:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:FlexLayout2"
             x:Class="FlexLayout2.MainPage">

    <FlexLayout
        Direction="Column"
        JustifyContent="Start"
        AlignItems="Stretch">
        <ContentView>
            <FlexLayout
                Direction="Row"
                JustifyContent="Start"
                AlignItems="Stretch">
                <BoxView Color="Red"/>
                <BoxView Color="Black"/>
            </FlexLayout>
        </ContentView>
        <BoxView Color="Yellow"/>
    </FlexLayout>
</ContentPage>
like image 79
Himanshu Dwivedi Avatar answered Oct 21 '22 07:10

Himanshu Dwivedi