Forum Xamarin.Forms

XF >1.3.4 Can't set StackLayout HorizontalOptions to Center

JosephGarroneJosephGarrone AUMember
edited March 2015 in Xamarin.Forms

I have been developing a Xamarin Forms app using XF 1.3.3 for a while now. I recently updated to 1.3.4 to give it a test. The stacklayouts kept displaying as broken (I have lots of StackLayouts with HorizontalOptions set to Center or CenterAndExpand) and they were autoexpanding to take up the full width. I reverted back to 1.3.3 to fix it. Now I really need to update to 1.4 (Because of XLabs), however my StackLayouts keep expanding to take up the entire screen.

Sample View (No CodeBehind changes are made to this XAML)


<AbsoluteLayout x:Name="Host" VerticalOptions="FillAndExpand" HorizontalOptions="Fill">
    <StackLayout x:Name="ScrollStack" Orientation="Vertical" AbsoluteLayout.LayoutBounds="0, 0, 1, 1" AbsoluteLayout.LayoutFlags="All">
        <ScrollView x:Name="Scroll" VerticalOptions="FillAndExpand" HorizontalOptions="Center">
                <OnPlatform x:TypeArguments="Thickness"
                    iOS="0, 20, 0, 0">

            <StackLayout x:Name="Stack" Orientation="Vertical" VerticalOptions="Center" HorizontalOptions="Center" Padding="30" BackgroundColor="{x:Static Sentinel:AppColours.THEME_60}">
                <Controls:PinEntry x:Name="PinEntry" PinLength="8" Prompt="ENTER PIN:" HorizontalOptions="Center"></Controls:PinEntry>

Previously, PinEntry (Just a ContentView with some images in it) only took up as much room as needed in the middle of the screen. Now it spans the entire screen. I believe this may have to do with the new Stacklayout rendering, but I can't be too sure.


(First post so let me know how I can add more info to aid anyone's investigations)

Sign In or Register to comment.