【问题标题】:How do I change the Title Background color On Windows Platform (Xamarin)如何在 Windows 平台 (Xamarin) 上更改标题背景颜色
【发布时间】:2017-06-02 23:58:18
【问题描述】:

Screen Shot 我正在使用 Visual Studio 2013 中的 Xamarin Forms 开发应用程序。我已设法更改 Android 的标题背景颜色,但我未能为 Windows 项目做同样的事情。它带有默认深色主题。请帮助我。 谢谢你

【问题讨论】:

  • 您应该向我们展示您的尝试。
  • @476rick 在 Android 上,我使用了我在 MainActity.cs 中引用的主题,但我不知道在 windows 平台上更改哪里
  • 您是否将您的页面放入 NavigationPage 中?如果是这样,我相信您可以使用 NavigationPage.BarBackgroundColorProperty 来设置该颜色
  • @deckertron_9000 它有效,我只需要那个...NavigationPage.BarBackgroundColorProperty

标签: xamarin xamarin.forms xamarin.uwp xamarin.windows


【解决方案1】:

NavigationPage.BarBackgroundColorProperty 有效!感谢您的建议。

【讨论】:

    【解决方案2】:

    你的问题对我来说不是很清楚,但我认为这就是你的意思。对于“标题背景颜色”,我认为您的意思是页面标题的背景颜色。

    这是我在 Xamarin.Forms 应用程序中使用的代码。该代码适用于 Android、iOS 和 UWP。

    public class ExamplePage : ContentPage
    {
        public ExamplePage()
        {
            Title = "Example Page";
            BackgroundColor = Color.Blue; //Make this any color you like
    
            Content = null; //put your own content here
        }
    }
    

    您可以指定每页背景颜色的颜色。

    【讨论】:

    • 感谢您的回复,我已在问题中添加了屏幕截图。我已经完成了你在 PCL 上的建议,但它不起作用
    • 您要更改后面的文字:“Vista Africa Brand Header”?你应该发布你班级的代码。
    【解决方案3】:
     <StackLayout.BackgroundColor>
                <OnPlatform x:TypeArguments="Color"
                                        Android="#51C0D4"
                                        WinPhone="#51C0D4"
                                        iOS="#51C0D4"></OnPlatform>
        </StackLayout.BackgroundColor>
    

    【讨论】:

      猜你喜欢
      • 2019-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-08
      • 1970-01-01
      • 2012-07-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多