0
votes

I have a MasterDetail page, Detail is a Naviagtion page, Master contains a Listview. I'm changing the color of the header bar background color and text using

((NavigationPage)Detail).BarBackgroundColor = Color.Navy;
((NavigationPage)Detail).BarTextColor = Color.White;

This changes the carrier bar text to white for both the Master and Detail sections, but only changes the carrier bar background on the Detail section, the Master is still white/transparent so the text is no longer visible. Is this a bug? I would expect the bar variables to work the same, to only work on the Navigation page since that is the page they are being applied to.

note- I am NOT setting the StatusBarStyle to LightContent, the status bar on a content page shows as black text on a white background.

iOS Carrier Bar

*Edit - I would expect it to look like this - the CarrierBarText color is changes only on the Navigation Page:

enter image description here

2

2 Answers

1
votes

I think this is expected behavior instead of a bug. The iOS status bar is translucent, but the navigation bar on the Detail page extends to the top of the window so the status bar looks like it has a color.

The Master page also extends to the top of the window so when it's pushed into view, the top 20px get displayed under the status bar, which in this case is just the background of the page. You can change the page's background to Navy to match the navigation bar so it appears more consistent.

0
votes

The only way to change the iOS Status Bar Color in Xamarin.Forms is to set the BarTextColor of a NavigationPage. Detail pages must be a NavigationPage, so they're able to set the BarTextColor property. Because the Master page isn’t a NavigationPage, it doesn’t have a BarTextColor property, and it can’t change the iOS Status Bar Color.

My recommendation is to change the background color of the Master page to a darker color (like Navy Blue) so that the white text in the iOS Status Bar is still visible.

James Montemago did a great blog post that talks about setting the iOS Status Bar Color: http://motzcod.es/post/110755300272/ios-tip-change-status-bar-icon-text-colors

If you are using Xamarin.forms you must also set the BarTextColor = Color.White on your NavigationPage! Additionally, you should go into your info.plist and set “View controller-based status bar appearance” to No