Change the color of a navigation page

2

I have this:

public  void Login_Clicked(object sender, EventArgs e)
        {
            LoginService svc = new LoginService();
            LoginRS res = svc.Login(txtUsuario.Text, txtSenha.Text);
            if (res != null && res.Success  )
            {
                App.LooggedUser = res;
                Application.Current.MainPage = new NavigationPage(new MainPage());

            }
            else if(res != null && ! res.Success)
            {
                lblErroLogin.Text = res.Exception;
            }
            else
            {
                lblErroLogin.Text = "Não foi possível realizar o Login, por favor verifique sua conexão com a Internet";
            }
        }

As I had a TabbedPage, I used this code, helped by a colleague here to create the NavigationBar. Turns out it comes with the default color (Blue) and I need to change to gray. I tried a BackgroundColor, but I do not have this method at that point in the code. There is a BarBackgroundColorProperty, but I am getting nothing so far. I'm reading about it, but I have not got anything concrete yet.

    
asked by anonymous 08.02.2018 / 13:55

1 answer

2

Just set the BarBackgroundColor property of the NavigationPage instance:

new NavigationPage(new MainPage()) { BarBackgroundColor = Color.Gray };
    
08.02.2018 / 13:59