I have a Tabbed page attached is a Navigation page I want to change the color or the bar itself and the title color but I am getting a exception:
(System.NullReferenceException: Object reference not set to an instance of an object.)
How can I change the color of my navigation bar and title color?
Here is my tabbed page xaml code:
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TBSApp.View"
x:Class="TBSApp.Tabbed_Page.TabPage"
NavigationPage.HasNavigationBar="False"
xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core"
android:TabbedPage.ToolbarPlacement="Bottom"
BarBackgroundColor="#fff"
android:TabbedPage.BarItemColor="#bbbbbb"
android:TabbedPage.BarSelectedItemColor="#fc5661">
<NavigationPage Title="Dashboard" Icon="home.png">
<x:Arguments>
<local:Dashboard />
</x:Arguments>
</NavigationPage>
Here is my Dashboard.xaml.cs code:
((NavigationPage)Application.Current.MainPage).BarBackgroundColor = Color.FromHex("#fff");
((NavigationPage)Application.Current.MainPage).BarTextColor = Color.FromHex("#203341");
Add this to your App.xaml
Use "CurrentPageChanged" event then you can able to change the colour and title of the navigation bar
Here is code snippet hope this will work