Xamarin Forms:如何更改主从内容页面的背景颜色?

Xamarin Forms: How to change the background color of the Master Detail content page?

我的项目中有一个主从页面,并在其中添加了一些内容页面作为子页面。如何更改子内容页面顶部栏的颜色?我使用 <NavigationPage.TitleView> 在顶部栏上添加了一些图标。

我需要更改红色方块的背景颜色。我已经尝试了首选 的解决方案,但这并没有解决我的问题。

要更改 Android 的导航栏背景颜色,请执行以下步骤:

Go to your Android Project -> Resources -> values -> styles.xml

打开 style.xaml 文件更新 colorPrimary 值与您需要的十六进制颜色代码

<!-- colorPrimary is used for the default action bar background -->
    <item name="colorPrimary">#3478c9</item>

对于iOS这可以从App.xaml文件中控制,不需要在iOS项目

中写任何东西
<Application.Resources>
    <ResourceDictionary>

      <!-- Styles -->
      <Style TargetType="NavigationPage">
        <Setter Property="BarBackgroundColor" Value="#3478c9"/>
        <Setter Property="BarTextColor" Value="White"/>
      </Style>
      <!-- Styles -->

    </ResourceDictionary>
  </Application.Resources>