Bug 56951 - View.VerticalOptions property doesn't work when inside StackLayout
Summary: View.VerticalOptions property doesn't work when inside StackLayout
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 2.3.4
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-05-30 02:12 UTC by Brian B
Modified: 2017-05-30 14:52 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Brian B 2017-05-30 02:12:20 UTC
The VerticalOptions property for Views seems to not be applied when running code, if the views are nested inside <StackLayout>. I have tried setting the property from both the XAML page and from the code-behind.

When taking a view out of StackLayout, It renders correctly.
I've tested on both Android and iOS. I am unable to set the property from the code behind as well.

Here's the xaml code

<?xml version="1.0" encoding="utf-8" ?>
        <Label x:Name="label" HorizontalOptions="Center" VerticalOptions="Center" Text="Hello World."></Label>
        <Slider x:Name="slider" ValueChanged="Slider_ValueChanged" HorizontalOptions="Center" VerticalOptions="Center" WidthRequest="250"></Slider>

And here's the code I tried in the code behind:

public GreetPage()
    label.VerticalOptions = LayoutOptions.Center;
    slider.VerticalOptions = LayoutOptions.Center;
    slider.Value = 0.5;

Here's what it looks like on iOS - http://imgur.com/Bob8gmh

And here's what it looks like on Android - http://imgur.com/GFhx6qv

I am currently using Xamarin.Forms version
Windows 10, VS Community 2017
Comment 1 Brian B 2017-05-30 02:20:57 UTC
Here is a google drive link for the project zip.

Comment 2 Brian B 2017-05-30 12:47:47 UTC
Here is github link

Comment 3 Brian B 2017-05-30 14:52:06 UTC
I am an idiot. please close. sorry.