How do I change the Title Background color On Wind

2019-09-06 10:37发布

问题:

Screen Shot I am developing an application using Xamarin Forms in Visual Studio 2013. I have managed to change the Header Background color for Android but I am failing to do the same for Windows project. It comes with the Default Dark theme. Please Assist me. Thank You

回答1:

NavigationPage.BarBackgroundColorProperty Works! Thank You for your suggestions.



回答2:

Your question is not very clear to me, but I think that this is what you mean. With "Header Background color" I think you mean the background color of the title of a page.

This is the code I use in my Xamarin.Forms application. The code works on Android, iOS and 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
    }
}

You can specify the color of the background color on every page.



回答3:

 <StackLayout.BackgroundColor>
            <OnPlatform x:TypeArguments="Color"
                                    Android="#51C0D4"
                                    WinPhone="#51C0D4"
                                    iOS="#51C0D4"></OnPlatform>
    </StackLayout.BackgroundColor>