<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="Navigator.App">

    <Application.Resources>

    <ControlTemplate x:Key="ActivityIndicatorTemplate">
      <Grid>
        <ContentPresenter />
        <StackLayout Style="{StaticResource BlockingPanel}"
                           IsVisible="{TemplateBinding BindingContext.IsBusy}">
          <ActivityIndicator Style="{StaticResource ActivityIndicatorStyle}"
                                     IsVisible="{TemplateBinding BindingContext.ShowActivity}"
                                     IsRunning="{TemplateBinding BindingContext.ShowActivity}" />
        </StackLayout>
      </Grid>
    </ControlTemplate>

      
    <ResourceDictionary>
      <!--Global Styles-->
      <Color x:Key="NavigationPrimary">#2196F3</Color>
      <Style TargetType="NavigationPage">
          <Setter Property="BarBackgroundColor" Value="{StaticResource NavigationPrimary}" />
          <Setter Property="BarTextColor" Value="White" />
      </Style>

      <!-- For the ActivityIndicatorTemplate-->
      <Color x:Key="BlockingColor">
        <x:Arguments>
          <x:Double>0</x:Double>
          <x:Double>0</x:Double>
          <x:Double>0</x:Double>
          <x:Double>0.75</x:Double>
        </x:Arguments>
      </Color>

      <Style x:Key="BlockingPanel" TargetType="StackLayout">
        <Setter Property="BackgroundColor" Value="{StaticResource BlockingColor}" />
        <Setter Property="HorizontalOptions" Value="FillAndExpand" />
        <Setter Property="VerticalOptions" Value="FillAndExpand" />
        <Setter Property="Opacity" Value="0.25" />
      </Style>

      <Style x:Key="ActivityIndicatorStyle" TargetType="ActivityIndicator">
        <Setter Property="Color" Value="White" />
        <Setter Property="HorizontalOptions" Value="CenterAndExpand" />
        <Setter Property="VerticalOptions" Value="CenterAndExpand" />
      </Style>

    </ResourceDictionary>
    </Application.Resources>

</Application>