Skip to main content

Xamarin.Forms OnPlatform - TabbedPage vs NavigationPage



I switched my start page from a NavigationPage to a TabbedPage and all of a sudden the content overwrote the the carrier/battery row.
 
I looked into this and discovered that the TabbedPage does not offset itself below this header in iOS (but works for android and windows). The solution is to add a platform dependent offset or padding thickness of 20 pixels.
 

Note: if you get the exception: "XamlParseException Type OnPlatform not found in xmlns http://xamarin.com/schemas/2014/forms"
... then change the xmlns namespace:
 - from "xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 - to "xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml".

References:

Comments

Popular posts from this blog

Xamarin.Forms persistance (aka save/load local settings)

I just learned and implemented how to persist local settings for a xamarin.forms app. At first read, I noticed that xamarin.forms Application.Current.Properties supports this functionality but I wasn't able to figure it out. Usually I like to use default functionality when available but this simple API was not working for me. So I did some research and found a bunch of alternatives from James Montemagno's settings plugin to the realm mobile database. For my simple needs at this time, I nuget'ed the settings plugin and had it working in 2-3m (only because I spent a minute reading the GettingStarted.html). The code is simple and looks like:

Save:
CrossSettings.Current.AddOrUpdateValue("Securities", _addedSecurities.ToFlatFile(','));

Load:
protected override void OnStart()
{
string securitiesCsv = CrossSettings.Current.GetValueOrDefault("Securities", string.Empty);
}