Remplir tout l'écran avec StackLayout

J'ai un StackLayout codé comme ceci:

StackLayout mainStackLayOut = new StackLayout{
    BackgroundColor = Color.Blue,
    //VerticalOptions = LayoutOptions.FillAndExpand,
    //WidthRequest = width,
    HorizontalOptions = LayoutOptions.FillAndExpand,
    Orientation = StackOrientation.Vertical
};

Mais je veux le StackLayout pour remplir tout l'écran de la largeur et de la hauteur, j'ai aussi de l'arbre ajout des boutons comme ceci:

StackLayout buttonsStackLayOut = new StackLayout
{
    BackgroundColor = Color.White,
    //VerticalOptions = LayoutOptions.Fill,
    HorizontalOptions = LayoutOptions.Fill,
    Orientation = StackOrientation.Horizontal,
    Spacing = 0
};
mainStackLayOut.Children.Add(buttonsStackLayOut);


Image doctorImage = new Image
{
    WidthRequest = width / 3,
    HeightRequest = 50,
    BackgroundColor = Color.Gray,
    Source = ImageSource.FromFile ("about.png")
};
buttonsStackLayOut.Children.Add(doctorImage);

Remplir tout l'écran avec StackLayout

Comment puis-je remplir tous les screensize?

  • quel est le problème? les lignes noires à gauche et à droite ?
  • Oui c'est exactement ce qui est le problème
  • avez-vous essayer de définir explicitement Padding="0"