I have a fairly simple layout that consists of an outer grid and two stacklayouts.
I use the outer grid so that my busy indicator can overlay the same content area.
My expectation is for the green stacklayout to expand to fill the grids one and only cell. It doesn't. Since it doesn't expand, it's nested children that are set to center appear stuck to the left side of the display. the ext:Stylish xaml extension is an extension I use to apply styles consistently throughout the application. The two styles in this xaml fragment are defined as:
<ext:Style x:Key="PageHeaderFrame" VerticalOptions="Start" HorizontalOptions="FillAndExpand" Padding="15,5"/>
<ext:Style x:Key="PageHeader" Font="Medium" TextColor="#f99999" HorizontalOptions="Center"/>
The pages xaml is:
<?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:ext="clr-namespace:Teachers.Extensions;assembly=Teachers"
xmlns:lb="clr-namespace:Xamarin.Forms.Labs.Behaviors;assembly=Xamarin.Forms.Labs"
xmlns:lc="clr-namespace:Xamarin.Forms.Labs.Controls;assembly=Xamarin.Forms.Labs"
xmlns:vm="clr-namespace:Teachers.ViewModel;assembly=Teachers"
x:Class="Teachers.Pages.IncidentPage">
<Grid lb:GridLayout.RowHeights="*" lb:GridLayout.ColumnWidths="*" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="Blue">
<!--Normal Layout-->
<StackLayout Grid.Row="0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="Green">
<Frame ext:Stylist.Style="{ext:Stylist PageHeaderFrame}">
<StackLayout Padding="0" Orientation="Horizontal" HorizontalOptions="Center">
<Label Text="Incidents" ext:Stylist.Style="{ext:Stylist PageHeader}"/>
</StackLayout>
</Frame>
<Grid lb:GridLayout.RowHeights="Auto" lb:GridLayout.ColumnWidths="*,*">
<Button Grid.Column="0" Text="All"/>
<Button Grid.Column="1" Text="Open"/>
</Grid>
<lc:RepeaterView x:TypeArguments="vm:IncidentVM" ItemsSource="{Binding Reports}"/>
</StackLayout>
<!--Busy indicator-->
<StackLayout Grid.Row="0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" IsVisible="{Binding IsBusy}" BackgroundColor="Gray" Opacity="0.2"/>
<ActivityIndicator Grid.Row="0" HorizontalOptions="Center" VerticalOptions="Center" IsRunning="{Binding IsBusy}"/>
<Label Grid.Row="0" Text="Loading Your Incident List...." VerticalOptions="End" HorizontalOptions="Center" IsVisible="{Binding IsBusy}"/>
</Grid>
</ContentPage>