Xamarin.Forms Platform specific visual adjustments Platform adjustments


Adjustments can be done for specific platforms from C# code, for example for changing padding for all the targeted platforms.

if (Device.OS == TargetPlatform.iOS) 
    panel.Padding = new Thickness (10);
    panel.Padding = new Thickness (20);

An helper method is also available for shortened C# declarations :

panel.Padding = new Thickness (Device.OnPlatform(10,20,0));

Those functionalities are also available directly from XAML code :

<StackLayout x:Name="panel">
    <OnPlatform x:TypeArguments="Thickness"
      Android="20" />