khalid karam
khalid karam

Reputation: 112

StackLayout's vertical alignment

I'm trying to put a button at the bottom of a StackLayout and it's not working. I don't know what I'm doing wrong!

enter image description here

Here's my template:

<Page actionBarHidden="true">
    <GridLayout rows="*, *, *, *" columns="*">
        <StackLayout horizontalAlignment="center"
                     verticalAlignment="center">
            <Label text="My Account" id="login-label"/>
        </StackLayout>
        <CardView row="1" class="cardStyle" margin="10"
                  elevation="40"
                  radius="4"
                  verticalAlignment="center"
                  horizontalAlignment="center"
                  rowSpan="2"
                  id="login-box">
            <StackLayout id="form-container">
                <TextField hint="Login"/>
                <TextField hint="Password"/>
                <Label text="Forgot password?" horizontalAlignment="right"/>
                <Button text="Button" @tap="loginButton()" verticalAlignment="bottom"/>
            </StackLayout>
        </CardView>
    </GridLayout>
</Page>

Thank you!

Upvotes: 2

Views: 5018

Answers (1)

Manoj
Manoj

Reputation: 21908

StackLayout do not support that by its design. It is used to just stack the child elements one after another in given orientation, you can't have mixed output - few child elements at top and few at bottom or center.

Use Grid / Dock layout in order to dock an element at bottom.

Upvotes: 2

Related Questions