C# – How to change backGround color in Xamarin forms NavigationPage

c++xamarinxamarin.forms

I'm trying to change the background color of navigationBar in navigationPage I'm using this code:

using System;
using System;
using Xamarin.Forms;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
namespace P
{
public class App : Application
{
    public App ()
    {
 MainPage = new NavigationPage(new LoginPage());
    }
    protected override void OnStart ()
    {
    }
    protected override void OnSleep ()
    {
    }
    protected override void OnResume ()
    {
        // Handle when your app resumes
    }
   }
  }

how can I do it?

Best Solution

Just set the BarBackgroundColor property of the NavigationPage instance:

new NavigationPage(new LoginPage()) { BarBackgroundColor = Color.Green };
Related Question