Ste*_*Pet 5 xaml xamarin.forms
在Xamarin.Forms 3.2.0中,Xamarin Forms引入了新的New OnPlatform/OnIdiom XAML扩展
根据博客,我们可以重写下面的代码,
<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>
Run Code Online (Sandbox Code Playgroud)
随着新的扩展.
<Button Text="Extensions" BackgroundColor="Black" TextColor="White"
HeightRequest="{OnPlatform iOS=60, Android=80, Default=40}"/>
Run Code Online (Sandbox Code Playgroud)
在这里,我怀疑的是我如何重复使用相同的OnIdiom XAML Extension for Margin/Thickness.
Ger*_*uis 12
你应该能够这样做: <Button Margin="{OnPlatform Android='10,5,10,0', iOS='10,20,10,0'}" />
这取决于你更喜欢哪种语法!
归档时间: |
|
查看次数: |
1138 次 |
最近记录: |