Reinaldo Peres
Reinaldo Peres

Reputation: 372

How to fill the entire screen with two buttons vertically

I have to fill all the screen with two buttons vertically

I already tried to use fill and expand:

<ContentPage.Content>
        <StackLayout>
            <Button Text="Histórico" 
                    BackgroundColor="Transparent"
                    BorderColor="Black"
                    BorderWidth="1"
                    Clicked="Timeline"
                    HorizontalOptions="FillAndExpand"
                    VerticalOptions="FillAndExpand"/>
            <Button Text="Minha Agenda"
                    BackgroundColor="Transparent" 
                    BorderColor="Black"
                    BorderWidth="1"
                    Clicked="MinhaAgenda"
                    HorizontalOptions="FillAndExpand"
                    VerticalOptions="FillAndExpand"/>
        </StackLayout>
    </ContentPage.Content>

It works, but this caused to much lag on the screen, i dont know why

Is there other solution for this?

Upvotes: 0

Views: 305

Answers (1)

Cheesebaron
Cheesebaron

Reputation: 24470

How about using a Grid, something like:

<ContentPage.Content>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Button Text="History"
                Grid.Row="0"
                HorizontalOptions="Fill"
                VerticalOptions="Fill" />

        <Button Text="Agenda"
                Grid.Row="1"
                HorizontalOptions="Fill"
                VerticalOptions="Fill" />

    </Grid>
</ContentPage.Content>

This will fill the view with two equally sized buttons.

Upvotes: 1

Related Questions