c# - 如何在 Xamarin 表单 NavigationPage 中更改背景色

标签 c# xamarin xamarin.forms

我正在尝试更改 navigationPage 中 navigationBar 的背景颜色我正在使用此代码:

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
    }
   }
  }

我该怎么做?

最佳答案

只需设置 NavigationPage 实例的 BarBackgroundColor 属性:

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

关于c# - 如何在 Xamarin 表单 NavigationPage 中更改背景色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28631362/

相关文章:

c# - 在 Unity 中读取二维码

c# - 如何使大型 if 语句更具可读性

xamarin.forms - Xamarin Forms ContentPage 背景图像平铺

c# - 使用SQL阅读器读取多行

c# - SqlDependency - 如何解释 SqlNotificationEventArgs 属性?

android - 从 3gpp 生成音频图

c# - 如何从 Xamarin Forms ListView 中删除项目?

android - Android 上的 MvvmCross 和链接问题

c# - 如何在 Xamarin Shell 中自定义顶部选项卡 (ShellSection) 的外观?

ios - 绑定(bind)到命令的 TapGestureRecognizer 中数据刷新的空引用异常