Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Xamarin.Forms iOS statusbar color

$
0
0

I am building an application in Xamarin.Forms, on the iOS app I want the status bar color to be white. After a while I managed to achieve this by doing the following,

App.cs

public App()
{
    NavigationPage _navigationPage = new NavigationPage(new RootPage());
    _navigationPage.BarTextColor = Color.White;

    MainPage = _navigationPage;
}

RootPage.cs

public class RootPage : TabbedPage
{
   public RootPage ()
   {
      Children.Add(new DashboardPage() {Title = "Dashboard", Icon = "home.png"});
      //Children.Add(new TestPage(){Title = "Agenda", Icon="calendar.png"});
   }
}

All works fine until I comment out the other page. It crashes the app on iPad's and makes the status bar black again on phones.

Crash on tablets:

Unhandled Exception: System.InvalidOperationException: Sequence contains no elements

After doing some research it seems like you can't have a MasterDetailPage inside of a NavigationPage. In that article someone provided a workaround for the crash but even with that the status bar still turns black when it contains a MasterDetailPage.

Is there any way this can be fixed or done in such a way that I don't even need a NavigationPage around all my content?


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>