Using StartAndExpand
or EndAndExpand
does not seem to actually expand the elements inside StackLayout
. Even though there is more space available as seen in the blue area. Only FillAndExpand
works.
Here is the code:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
xmlns:local="clr-namespace:App6"
x:Class="App6.MainPage"
ios:Page.UseSafeArea="True">
<StackLayout BackgroundColor="Blue"
HeightRequest="100"
Orientation="Horizontal"
Spacing="0"
VerticalOptions="Start">
<Label BackgroundColor="Red"
HorizontalOptions="Start"
Text="Hi" />
<StackLayout BackgroundColor="Salmon"
HorizontalOptions="EndAndExpand"
Orientation="Vertical">
<BoxView BackgroundColor="Red"
HeightRequest="30"
HorizontalOptions="End"
VerticalOptions="Center"
WidthRequest="30" />
</StackLayout>
</StackLayout>
</ContentPage>
And here is what I get:
Top result is when using FillAndExpand
for the child StackLayout
, followed by EndAndExpand
which does not expand, and lastly StartAndExpand
, which also does not expand.
Isn't expand supposed to expand the element if the parent element has more space? If yes, why then StartAndExpand
and EndAndExpand
does not work?
Note: This is tested on Android only with Xamarin.Forms version 3.4.0.1008975.