Hidden Stacklayout taking up space in xamarin forms

Viewed 10145

I'm creating a form in Xaml using Xamrin which contains absolute layout in which i'm hiding a stacklayout. but one more stacklayout just down below of hidden stacklayout but hidden stacklayout is taking up space.

What i want to do.When i did hide one stacklayout another stacklayout should take place of hidden staklayout.

4 Answers

My recomendation is putting a StackLayout at the bottom of the content, in order to keep the original height of the other elements at the top.

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="CentroDono.Views.YOURVIEWPAGE"
              Title="YOURVIEWTITLE"
             x:Name="YOURPAGECONTENTNAME">
    <ContentPage.Content>
        <StackLayout>
        <!--VISIBLE CONTENT-->
            <Label Text="HELLO"/>
        </StackLayout>
        <StackLayout>
            <Label Text="FOOTER"/>
            <!--INVISIBLE CONTENT-->    
            <Label x:Name="_searchText"  Text="Result1" IsVisible="False"/>
            <Label x:Name="_searchText2"  Text="Result2" IsVisible="False"/>
            <Label x:Name="_searchText3"  Text="Result3" IsVisible="False"/>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>
Related