Reputation: 71
It is possible to change the top TabBars BackgroundColor by setting "Shell.BackgroundColor". But that will also change the BackgroundColor of NavigationBar (Green area).
Does anyone know how to change the BackgroundColor of the top TabBar without changing the BackgroundColor of NavigationBar?
What's also strange. By setting "Shell.BackgroundColor" both colors will be set (Shell top TabBar and NavigationBar), but they are slightly differently colored. Does anyone know why?
Upvotes: 0
Views: 698
Reputation: 71
It seems like there is already a GitHub issue for that https://github.com/xamarin/Xamarin.Forms/issues/6711
I hope this is helpful
public class CustomShellRenderer : ShellRenderer
{
protected override IShellSectionRenderer CreateShellSectionRenderer(ShellSection shellSection)
{
var renderer = base.CreateShellSectionRenderer(shellSection);
if (renderer != null)
{
var a = (renderer as ShellSectionRenderer);
(renderer as ShellSectionRenderer).NavigationBar.Translucent = false;
}
return renderer;
}
protected override IShellItemRenderer CreateShellItemRenderer(ShellItem item)
{
var renderer = base.CreateShellItemRenderer(item);
(renderer as ShellItemRenderer).TabBar.Translucent = false;
return renderer;
}
}
Or set Shell.BackgroundColor to an empty value -> Shell.BackgroundColor=""
Upvotes: 1