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

[V-1.3.1][Android] Issues with NavigationPage BarBackgroundColor and BarTextColor

$
0
0

I'm using a MasterDetail page, and when the root page initially loads, I set the Detail as such.

// CONSTRUCTOR
        // this'll actually be set on the first menu item select
        var detailPage = new NavigationPage(new ContentPage())
        {
            BarBackgroundColor = Color.FromHex("#217dbb"),
            BarTextColor = Color.FromHex("#b6daf2")
        };
        Master = menuPageFactory.Init(OnToggleRequest());
        Detail = detailPage;
        App.Navigation = detailPage.Navigation;

Then whenever a user navigates, I trigger this call.

    private void TriggerNavitation(MenuItemViewModel itemToSelect)
    {
        if (_currentSelectedItem != null && itemToSelect.GetHashCode() == _currentSelectedItem.GetHashCode())
        {
            // don't load anything if you're returning to the same page
            _onToggleRequest(RootPage.NavigationDrawerState.Closed);
            return;
        }
        _currentSelectedItem = itemToSelect;

        var detail = new NavigationPage(_taskPageFactory.Init(itemToSelect))
        {
            BackgroundColor = Color.FromHex("#217dbb"),
            BarBackgroundColor = Color.FromHex("#217dbb"),
            BarTextColor = Color.FromHex("#b6daf2")
        };
        App.Navigation = detail.Navigation;

        ((MasterDetailPage)Parent).Detail = detail;

        _onToggleRequest(RootPage.NavigationDrawerState.Closed);
    }

The issue I'm having is that sometimes the colors don't take, and I'm not sure why. My app inherits from Theme.Holo.Light, and so once in a while I get a light gray navigation bar.

What do I need to do to ensure it's always #217dbb?


Viewing all articles
Browse latest Browse all 58056

Trending Articles