Hi guys!
I can't get my head around the following issue after reading a lot about this. My app has got an hamburger-menu and two additional buttons in the actionbar. The problem is (as you can see in the screenshot below) that the actionbar isn't taking the same (green-ish) backgroundcolor as the rest of the app.
From what I learned after several attempts and spending several hours of investigating this issue, is that I need to use a navigationpage as a mainpage in my App.xaml.cs. So I've done that;
public App()
{
InitializeComponent();
if (IsLoggedIn())
{
//MainPage = new MainPage();
MainPage = new NavigationPage(new MainPage());
//MainPage = new NavigationPage(new MainPage()) { BarBackgroundColor = Color.FromHex("#55BBAB"), BarTextColor = Color.FromHex("#FFF") };
}
else
{
//MainPage = new LoaderPage();
MainPage = new SignIn();
}
}
After adding the line of code which instantiates the NavigationPage, I was suddenly stuck with two actionbars! I finally got this fixed by setting the option 'SetHasNavigationBar';
public MainPage()
{
InitializeComponent();
MasterBehavior = MasterBehavior.Popover;
////https://stackoverflow.com/questions/51824298/duplicate-xamarin-navbar-toolbar-items?rq=1
NavigationPage.SetHasNavigationBar(this, false);
//MenuPages.Add((int)EMenuItemType.Browse, (NavigationPage)Detail);
}
But whatever I try, I can't change the color of the actionbar / navigationbar. I tried suggestions similar to these;
- https://forums.xamarin.com/discussion/98711/change-background-color-of-toolbaritems
- https://stackoverflow.com/questions/32147926/setting-background-color-of-xamarin-toolbaritems
- https://stackoverflow.com/questions/25726604/change-actionbar-color-xamarin
But none of them seem to work. Is there anyone here who can help me out on this one? It's driving me nuts!