Reputation: 756
I want to add a background image to my Xamarin Forms App. I've tried the solution defined here : Xamarin forms background image for all Pages. But this doesn't seem to work. I've also tried setting it via Xaml like this
<Style TargetType="ContentPage">
<Setter Property="BackgroundImage" Value="MyImage.jpg" />
</Style>
To no avail. Any pointers would be appreciated. I'm working on Xamarin Forms version 2.3.2.127
Upvotes: 1
Views: 1552
Reputation: 16232
You are defining an implicit Style
for ContentPage
, and if it's defined at the Application
level ResourceDictionary
it will be applied to all ContentPage
s.
With the scarce context and information you are giving, I can only guess what's going on. You probably have no ContentPage
s in your app, but multiple pages inheriting from ContentPage
. If you want that to work, you have to set the property ApplyToDerivedTypes
to true
in your Style
:
<Style TargetType="ContentPage" ApplyToDerivedTypes="true">
<Setter Property="BackgroundImage" Value="MyImage.jpg" />
</Style>
Upvotes: 4