Every platform as we know has its own screen metric system, and while Xamarin.Forms does a great job of creating a cross-platform UI and following the platform specifics, we often might need some platform tweaking.
Fortunately, Xamarin.Forms has an out-of-the-box feature that we can use in XAML and in code.
In Visual Studio, create a
Xamarin Forms (Portable)
project; give it the nameXamFormsOnPlatform
.Right-click and Add | New Item… in the PCL core project. Create a new Forms Xaml Page and name it
MainPage
.Open the
MainPage.xaml
file, remove the default label, and add the following in theContentPage
tag:<ContentPage.BackgroundColor> <OnPlatform x:TypeArguments="Color"> <OnPlatform.iOS>#FF0000</OnPlatform.iOS> <OnPlatform.Android>#00FF00</OnPlatform.Android> <OnPlatform.WinPhone>#51C0D4</OnPlatform.WinPhone> </OnPlatform> </ContentPage.BackgroundColor>
Go...