Quantcast
Channel: User Liyun Zhang - MSFT - Stack Overflow
Viewing all articles
Browse latest Browse all 445

Answer by Liyun Zhang - MSFT for Auto applying element styles

$
0
0

You can use ApplyToDerivedTypes = "True" in the Styles.xaml to do that:

<Style x:Key="ContentPageStyle" TargetType="ContentPage" ApplyToDerivedTypes = "True"> <Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource MyColor}}" /></Style>

In addition, don't forget to add the color in the Colors.xaml:

<Color x:Key="MyColor">#020202</Color>

And you will find <Style TargetType="Page" ApplyToDerivedTypes = "True"> in the Styles.xaml. You can just change the setter in it and the contentpage will auto apply it.


Viewing all articles
Browse latest Browse all 445

Trending Articles



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