Xamarin.Forms Guides | Samples

Xamarin.Forms.View.VerticalOptions Property

Gets or sets the LayoutOptions that define how the element gets laid in a layout cycle. This is a bindable property.


public LayoutOptions VerticalOptions { get; set; }


A LayoutOptions which defines how to lay out the element. Default value is LayoutOptions.Fill unless otherwise documented.


Assigning the VerticalOptions modifies how the element is laid out when there is excess space available along the Y axis from the parent layout. Additionally it specifies if the element should consume leftover space in the Y axis from the parent layout. If multiple children of a layout are set to expand, the extra space is distributed proportionally.

This example creates four views and adds them to a stack, each laying out in a different manner.

C# Example

  private View CreateButtons ()
    var button1 = new Button {Text = "TopAligned", VerticalOptions=LayoutOptions.Start};
    var button2 = new Button {Text = "CenterAligned", VerticalOptions=LayoutOptions.Center};
    var button3 = new Button {Text = "BottomAligned", VerticalOptions=LayoutOptions.End};
    var button4 = new Button {Text = "Fill", VerticalOptions=LayoutOptions.Fill};

    StackLayout stack = new StackLayout {
      Orientation = StackOrientation.Horizontal,
      Children = {

    return stack;


Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions:,,,,,,