[Xamarin Forms Xaml] Implicit style is not working with certain controls (code error or bug?)

SergeiGarciaSergeiGarcia MXMember, University

I'm working on a simple Xamarin forms example that tests Style implicit inheritance. Here is my app.xaml:
[edit: Changed Frame.BackgroundColor.Value on the Xaml to Red]

I tried implementing this in a simple page:

But for some reason, when I run this the contentPage.BackgroundColor and Frame.Padding properties get completely ignored. Instead, I get an app that looks like this:

What am I doing wrong? Or is this a bug in Xamarin Forms?

Best Answer


  • rene_ruppertrene_ruppert DEXamarin Team, University, XamUProfessors Xamurai

    I don't think you're doing anything wrong. It looks like implicit styling simply does not work. You can move the styles to the page itself and they still won't have any effect.
    I'm trying to figure out if this is a bug or default behavior and then post here as soon as a I know something.

  • SergeiGarciaSergeiGarcia MXMember, University

    Thank you René, that was very helpful

  • MarkSmith.8123MarkSmith.8123 USXamarin Team, University, XamUProfessors Xamurai

    Just as a side note, this is how XAML works - even on the Microsoft platform. Implicit styles are only applied directly to the types they are associated with, not to any derived types. The solutions @rene_ruppert has outlined here are exactly how you would do this in WPF for example.

Sign In or Register to comment.