Margin provided for labels in Xaml is not picking up in Xamarin Forms

by soccerway   Last Updated August 14, 2019 05:26 AM - source

I would like to push the labels FullName, Status, CurrenDate from top to 10px in the row displaying in Xamarin Forms ? I have tried with Margin:"10,0,0,0", but the margin is not working for me. I would like to set the alignment via xaml and not via code.

                    <Grid BackgroundColor="#584961">
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="2*"/>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="2*"/>
                        <image:CircleImage x:Name="PlayerPic" Source="{Binding PlayerImage, Converter={StaticResource ByteArrayToImage}}" WidthRequest="50" HeightRequest="50" Grid.Column="0" VerticalOptions="Center"/>
                        <StackLayout Grid.Column="1">
                            <Label Text="{Binding FullName}" TextColor="White" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" Margin="10,0,0,0"/>
                        <StackLayout Grid.Column="2">
                            <Label Text="{Binding SoccerStatus}" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" TextColor="White" Margin="10,0,0,0"/>
                        <StackLayout Grid.Column="3">
                            <Label Text="{Binding CurrentDate}" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" TextColor="White" Margin="10,0,0,0"/>

enter image description here

Answers 1

Margins and Padding in Forms are of type Thickness.

defined by four distinct values that are applied to the left, top, right, and bottom sides of the element.

August 14, 2019 05:24 AM

Related Questions

Xamarin.Forms: Hide ListView on Map click?

Updated February 13, 2019 05:26 AM

Xamarin.Forms Xaml background Image

Updated October 11, 2016 09:11 AM

Display text with icon in Xamarin forms

Updated July 08, 2017 09:26 AM