NavigationPage Bar Separator on iOS

Download Sample Download the sample

This iOS platform-specific hides the separator line and shadow that is at the bottom of the navigation bar on a NavigationPage. It's consumed in XAML by setting the NavigationPage.HideNavigationBarSeparator bindable property to false:

<NavigationPage ...
                xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
                ios:NavigationPage.HideNavigationBarSeparator="true">

</NavigationPage>

Alternatively, it can be consumed from C# using the fluent API:

using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;

public class iOSTitleViewNavigationPageCS : Xamarin.Forms.NavigationPage
{
    public iOSTitleViewNavigationPageCS()
    {
        On<iOS>().SetHideNavigationBarSeparator(true);
    }
}

The NavigationPage.On<iOS> method specifies that this platform-specific will only run on iOS. The NavigationPage.SetHideNavigationBarSeparator method, in the Xamarin.Forms.PlatformConfiguration.iOSSpecific namespace, is used to control whether the navigation bar separator is hidden. In addition, the NavigationPage.HideNavigationBarSeparator method can be used to return whether the navigation bar separator is hidden.

The result is that the navigation bar separator on a NavigationPage can be hidden:

NavigationPage navigation bar hidden