问题描述
我已经用xamarinforms设计了一个完整的应用程序,我想在应用程序中所有按钮的10个点上添加左右填充,有没有办法使用App.xaml或其他更改填充的方法仅适用于iOS平台的按钮?
解决方法
检查这两个ms文档:
- global style(您仍可以覆盖特定页面上的边距/填充)
- XAML markup for platform
这是您的App.xaml的示例:
<Application.Resources>
<ResourceDictionary>
<Style ApplyToDerivedTypes="True" TargetType="Button">
<Setter Property="Margin" Value="{x:OnPlatform iOS='10,0',Android='0'}" />
</Style>
</ResourceDictionary>
</Application.Resources>