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

Trying to position a grid on my screen

$
0
0

Hello,

I am trying to position this (1x2)grid that contains an entry field next to a button on my screen. The grid should lay on top of the button that called it originally. I am trying to move the grid vertically down but I don't know what property to use to do that. I have tried anchorY, anchorX properties but they don't do anything. Can someone please tell me how to move it down vertically?

My code is the following...

Thanks in advance

var grid = new Grid
        {

            RowDefinitions =
            {

                 new RowDefinition {Height = GridLength.Auto},
            },

            ColumnDefinitions =
            {
                new ColumnDefinition {Width = new GridLength(5, GridUnitType.Star)},
                new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)}
            }
        };

        var entryField = new Entry
        {
            Text = "Email",
            BackgroundColor = Color.White,
            TextColor = Color.FromHex("856202"),
        };

        var button = new GradientButton
        {
            HorizontalOptions = LayoutOptions.FillAndExpand,
            VerticalOptions = LayoutOptions.FillAndExpand,
            Text = "Send",
            TextColor = Color.FromHex("856202"),
        };


        grid.Children.Add(button, 1, 0);
        grid.Children.Add(entryField, 0, 0);

        BackgroundColor = Color.Transparent;

    Padding = 40;

        Content = grid;

Viewing all articles
Browse latest Browse all 77050

Trending Articles



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