Ala*_*an2 1 xamarin xamarin.forms
到目前为止我的代码如下所示:
<OnPlatform x:Key="smallLabelFontSize" x:TypeArguments="x:Double" iOS="12" Android="10" WinPhone="14" />
<Style x:Key="smallLabel" TargetType="Label">
<Setter Property="FontSize" Value="{StaticResource smallLabelFontSize}" />
<Setter Property="TextColor" Value="#999999" />
</Style>
Run Code Online (Sandbox Code Playgroud)
有没有一种方法可以使用 OnPlatform 在样式中设置 FontSize,而不必引用smallLabelFontSize?
我查看了这里,但看不到任何如何操作的示例
https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/styles/xaml/application
就像是:
<Style TargetType="Label">
<Setter Property="FontSize">
<Setter.Value>
<OnPlatform x:TypeArguments="x:Double">
<On Platform="iOS" Value="12"/>
<On Platform="Android" Value="10"/>
</OnPlatform>
</Setter.Value>
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
902 次 |
| 最近记录: |