I have a simple XF app that leverages FreshMVVM. All works great, but I am using the NavigationPage.TitleView element to customize the navigation bar layout. When I push a modal page, the modal page's navigation coloring isn't correct. If you push as a non-modal it works fine.
Notice in the image below when the page shows the navigation bar is blue, but the modal shows white. How can this be changed so the dialog nav bar is consistent with the main page (ie, blue)?
The source for this example can be downloaded from here.
Here is my app.xaml.cs which sets everything up. Notice I am setting the colors for the navigation bar.
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new MainPage();
var mainPage = FreshPageModelResolver.ResolvePageModel<MainPageModel>();
var mainNavigation = new FreshNavigationContainer(mainPage);
mainNavigation.BarBackgroundColor = Color.FromRgb(0, 69, 140);
mainNavigation.BarTextColor = Color.White;
MainPage = mainNavigation;
}
}
MainPage.xaml
<ContentPage 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="SampleApp.MainPage">
<NavigationPage.TitleView>
<StackLayout HorizontalOptions="Center"
VerticalOptions="Center">
<Label Text="Page Title" />
</StackLayout>
</NavigationPage.TitleView>
<StackLayout>
<!-- Place new controls here -->
<Label Text="Welcome to Xamarin.Forms!"
HorizontalOptions="Center"
VerticalOptions="Center" />
<Button Command="{Binding OpenDialog}"
Text="Open Dialog"
VerticalOptions="End" />
</StackLayout>
</ContentPage>
MainPageModel
public class MainPageModel : FreshBasePageModel
{
// template command
public Command OpenDialog
{
get
{
return new Command(_ =>
{
CoreMethods.PushPageModel<DialogPageModel>(null, modal: true);
});
}
}
}
DialogPage.xaml
<ContentPage 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="SampleApp.DialogPage">
<NavigationPage.TitleView>
<StackLayout HorizontalOptions="Center"
VerticalOptions="Center">
<Label Text="Page Title" />
</StackLayout>
</NavigationPage.TitleView>
<ContentPage.Content>
<StackLayout>
<Label Text="Dialog Page"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
<Button Text="Close"
Clicked="Button_Clicked" />
</StackLayout>
</ContentPage.Content>
</ContentPage>