I have a problem. I want to create a StackLayout that has the width and height of the screen size, so it will be a square. I already tried this:

```
public Page1()
{
    InitializeComponent();

    imageLayout.HeightRequest = Application.Current.MainPage.Width;
    imageLayout.WidthRequest = Application.Current.MainPage.Width;
}

```

But that gave me the error that `Application.Current.MainPage` is null.

How can I fix this?