Forum Xamarin.Forms

Dynamically change system bar color


I am trying to change system bar color according to some property of the View that is currently opened so that it matches NavigationBar color. I am changing NavigationBar color in OnAppearing overriden method in view's backing code by setting dynamic resource value:

in App.xaml


and in OnAppearing:
Application.Current.Resources["NavigationBarColor"] = selectedColor;

However, there is no way to use this approach for changing system bar color. I got it to work for iOS by adding the following to Info.plist file:


But no luck for Android part still. The furthest I got is to use CustomRenderer for base page and override OnElementPropertyChanged event in it so that I could monitor if my property of interest is changed and change StatusBar color accordingly:


However, if I use back button to go to page that should have different color, the renderer will not be attached to the window (since the page was already present in the Navigation stack) and the color does not get changed.

Please help, I have been banging my head off the wall for days now.

Best Answer



    Thanks , It helped me a lot

Sign In or Register to comment.