Xamarin:StyleonPlatform和DynamicSource
我已经定义了一个样式,但是我想将Android和iOS的值设置为DynamicSource—语法是什么Xamarin:StyleonPlatform和DynamicSource,xamarin,xamarin.forms,Xamarin,Xamarin.forms,我已经定义了一个样式,但是我想将Android和iOS的值设置为DynamicSource—语法是什么 <Style TargetType="SearchBar" ApplyToDerivedTypes="true"> <Setter Property="BackgroundColor" Value="{OnPlatform Android='White', iOS='#4F8BBF'}"/> </Style> 根据不同目标的不同值的官方文件
<Style
TargetType="SearchBar" ApplyToDerivedTypes="true">
<Setter Property="BackgroundColor" Value="{OnPlatform Android='White', iOS='#4F8BBF'}"/>
</Style>
根据不同目标的不同值的官方文件
白烟
白烟
#2196F3
黑色
白色
这是为了设置不同的值
但如果您真的在寻找文本动态资源,您必须在代码隐藏构造函数中设置它
Resources[“searchBarStyle”]=Resources[“blueSearchBarStyle”];