I'm trying to style a page in an XF app. I would like to set the style in one place and have that flow through to all of my screens. Unfortunately, I am doing something incorrect. I have the following code in my App class. The background is a white image. The background is the default black in the android emulator.
public App()
{
Application.Current.Resources = new ResourceDictionary();
var pageStyle = new Style(typeof(Page))
{
BaseResourceKey = Device.Styles.BodyStyleKey,
Setters =
{
new Setter { Property = Page.BackgroundImageProperty, Value = "background.jpg"},
}
};
Application.Current.Resources.Add(pageStyle);
MainPage = new ContentPage();
Just to verify things, I put the following line in, and everything worked as expected. I just don't want to have to do this on every page. :-) I know that the image is there and readable as I want it to be.
MainPage.BackgroundImage = "background.jpg";
All suggestions are welcome. Thanks for your time. :-)
Wally