Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Aligning two buttons horizontally

$
0
0


As you can see in my screenshot, currently the 'Save' button is below the 'Clear' button. How do I get the two buttons to be in line with each other?

<?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:CrossPlatformApp;assembly=CrossPlatformApp"
             x:Class="CrossPlatformApp.MainPage">

    <StackLayout>
        <Label Text="Welcome!"
           TextColor="DarkBlue"
           Font="Impact"
           FontSize="Large"
           HorizontalOptions="Center"
           VerticalOptions="Start"
         />

        <Label Text="Enter your details below." 
           HorizontalOptions="Center"
           VerticalOptions="Start"
         />

        <local:MyEntry x:Name="txtFirstName"
           Placeholder="First Name"
           Keyboard="Text"
           TextColor="DarkBlue"
           PlaceholderColor="DarkBlue"
           Completed="NameCompleted"
           HorizontalOptions="Start"
           WidthRequest="300"
           Text="{Binding FirstName, Mode=TwoWay}"
           IsSpellCheckEnabled="False"
         />

        <local:MyEntry x:Name="txtLastName"
           Placeholder="Last Name"
           Keyboard="Text"
           TextColor="DarkBlue"
           PlaceholderColor="DarkBlue"
           Completed="NameCompleted"
           HorizontalOptions="Start"
           WidthRequest="300"
           Text="{Binding Surname, Mode=TwoWay}"
         />

        <Entry x:Name="txtAge"
           Placeholder="Age"
           Keyboard="Numeric"
           TextColor="DarkBlue"
           PlaceholderColor="DarkBlue"
           Completed="AgeCompleted"
           HorizontalOptions="Start"
           WidthRequest="55"
           Text="{Binding Age, Mode=TwoWay}"
         />

        <Label x:Name="lblName"
           Text="About me:"
           TextColor="Black"
           FontSize="14"
           VerticalOptions="Center"             
        />

        <Editor x:Name="txtBio"
           Keyboard="Text"
           TextColor="Black"
           FontSize="16"
           VerticalOptions="StartAndExpand"
           HeightRequest="150"
           IsSpellCheckEnabled="True"
         />

        <Button x:Name="btnClear"
         BackgroundColor="LightGray"
         BorderColor="Black"
         Clicked="ClearForm"
         Font="Impact"
         FontSize="12"
         HeightRequest="65"
         HorizontalOptions="Start"
         Margin="7"
         Text="Clear"
         WidthRequest="100"
        />

        <Button x:Name="btnSave"
         BackgroundColor="LightGray"
         BorderColor="Black"
         Clicked="SaveData"
         Font="Impact"
         FontSize="12"
         HeightRequest="65"
         HorizontalOptions="End"
         Margin="7"
         Text="Save"
         WidthRequest="100"

         />
    </StackLayout>
</ContentPage>

Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>