Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Styling weirdness

$
0
0

I've got some styling that I have setup in my App.cs File. It is shown below.
Application.Current.Resources = new ResourceDictionary();
var pageStyle = new Style(typeof(ContentPage))
{
Setters =
{
new Setter { Property = Page.BackgroundImageProperty, Value = "background.jpg"},
}
};
var labelStyle = new Style(typeof(Label))
{
Setters =
{
new Setter { Property = Label.TextColorProperty, Value="Black"},
}
};
var entryStyle = new Style(typeof(Entry) )
{
Setters =
{
new Setter {Property = Entry.BackgroundColorProperty, Value="Black"},
}
};
Application.Current.Resources.Add("PageStyle", pageStyle);

Unfortunately, the styling is not found when I attempt to assign a style to an element, such as the page background that I set here. The resources object states that the style I want to use is not there. The page that I have has the following two elements in the resources section of the xaml. These Resources are showing up in the Resources object.
<ContentPage.Resources>
<ResourceDictionary>
<local:StringIsNotEmptyConverter x:Key="hasError" />
<local:ReverseBooleanConverter x:Key="reverseBool" />
</ResourceDictionary>
</ ContentPage.Resources >

My assumption in this is that the Resources listed in the page will cause an over write of the Resources in memory. Is that correct? Am I in the neighborhood? thanks for your time.

Wally


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>