Newly working in Xamarin and it appears that if I try to set a style for ContentPage nothing happens
Xaml in App.xaml's ResourceDictionary:
<Style TargetType="ContentPage">
<Setter Property="BackgroundColor" Value="#f8f8f8"/>
</Style>
I know that the app.xaml style is being read. I have a button style that has been applied globally. But I cannot seem to affect any change on ContentPage. No errors are being reported.
How can I globally set the backgroundcolor?
I've read that this might be a bug, but that was a year ago. If it is still a bug is there a workaround?
Following code in App.xaml works for me:
<Style TargetType="ContentPage" ApplyToDerivedTypes="True">
<Setter Property="BackgroundColor" Value="Lime" />
</Style>
Note:
x:Key in Style.ApplyToDerivedTypes="True"I found solution at https://putridparrot.com/blog/styles-in-xamarin-forms/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With