I want to change the status bar color on some views.
I found this solution https://github.com/yuv4ik/XFDynamicStatusBarAppearance
but it's working only with NavigationPage.
I don't need from my app Navigation Page ...
public App()
{
InitializeComponent();
MainPage = new MainPage();
}
Here is my try ...
var statusBarStyleManager = DependencyService.Get<IStatusBarStyleManager>();
MainCarousel.PositionChanged += (sender, e) =>
{
switch (e.CurrentPosition)
{
case 1:
Device.BeginInvokeOnMainThread(() =>
{
Xamarin.Forms.Application.Current.MainPage.SetValue(Xamarin.Forms.NavigationPage.BarBackgroundColorProperty, Color.DarkCyan);
//((Xamarin.Forms.NavigationPage)Xamarin.Forms.Application.Current.MainPage).BarBackgroundColor = Color.DarkCyan;
statusBarStyleManager.SetDarkTheme();
});
break;
case 0:
case 2:
Device.BeginInvokeOnMainThread(() =>
{
Xamarin.Forms.Application.Current.MainPage.SetValue(Xamarin.Forms.NavigationPage.BarBackgroundColorProperty, Color.LightGreen);
statusBarStyleManager.SetLightTheme();
});
break;
default:
break;
}
};
How can I change the status bar color ?