新的OnPlatform/OnIdiom XAML扩展-用于边缘厚度
在Xamarin.Forms 3.2.0中,Xamarin Forms在平台/OnIdiom XAML扩展中引入了新的 根据下面的代码,我们可以重新编写下面的代码新的OnPlatform/OnIdiom XAML扩展-用于边缘厚度,xaml,xamarin.forms,Xaml,Xamarin.forms,在Xamarin.Forms 3.2.0中,Xamarin Forms在平台/OnIdiom XAML扩展中引入了新的 根据下面的代码,我们可以重新编写下面的代码 <Button Text="Extensions" BackgroundColor="Black" TextColor="White"> <Button.HeightRequest> <OnPlatform x:TypeArguments="x:Double" Default="40">
<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扩展重新用于边距/厚度。您应该能够这样做:
这取决于你更喜欢哪种语法 使用扩展属性格式,而不是内联属性格式。请参阅另一篇文章,它将引导您完成以下内容: