【发布时间】:2019-03-25 15:08:32
【问题描述】:
在 Xamarin.Forms 3.2.0 中,Xamarin Forms 引入了新的新 OnPlatform/OnIdiom XAML 扩展
根据blog我们可以重写下面的代码,
<Button Text="Extensions" BackgroundColor="Black" TextColor="White">
<Button.HeightRequest>
<OnPlatform x:TypeArguments="x:Double" Default="40">
<On Platform="iOS" Value="60"/>
<On Platform="Android" Value="80"/>
</OnPlatform>
</Button.HeightRequest>
使用新的扩展名。
<Button Text="Extensions" BackgroundColor="Black" TextColor="White"
HeightRequest="{OnPlatform iOS=60, Android=80, Default=40}"/>
我的疑问是如何将相同的 OnIdiom XAML 扩展 用于 Margin / Thickness。
【问题讨论】:
-
使用扩展属性格式,而不是内联属性格式。请参阅另一篇将引导您完成的文章:stackoverflow.com/questions/40111252/…
标签: xaml xamarin.forms