Shimon Wiener Shimon Wiener - 2 months ago 16
C# Question

How to change backGround colr in Xamarin forms NavigationPage

Im new to Xamarin forms and 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?

Answer

Just set the BarBackgroundColor property of the NavigationPage instance:

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