Changing the bar color of a Navigation page

Asked

Viewed 865 times

2

I have it:

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. It happens that it comes with the standard color(Blue) and need to change to the gray color. I tried a Backgroundcolor, but I don’t have this method at this point in the code. There is a Barbackgroundcolorproperty, but I’m not getting anything so far. I’m reading about it, but I still haven’t got anything concrete.

1 answer

2


Just configure the Barbackgroundcolor property of the Navigationpage instance:

new NavigationPage(new MainPage()) { BarBackgroundColor = Color.Gray };

Browser other questions tagged

You are not signed in. Login or sign up in order to post.