MasterDetailPage Navigation Bar on Windows

Download Sample Download the sample

This Universal Windows Platform platform-specific is used to collapse the navigation bar on a MasterDetailPage, and is consumed in XAML by setting the MasterDetailPage.CollapseStyle and MasterDetailPage.CollapsedPaneWidth attached properties:

<MasterDetailPage ...

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

using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.WindowsSpecific;


The MasterDetailPage.On<Windows> method specifies that this platform-specific will only run on Windows. The Page.SetCollapseStyle method, in the Xamarin.Forms.PlatformConfiguration.WindowsSpecific namespace, is used to specify the collapse style, with the CollapseStyle enumeration providing two values: Full and Partial. The MasterDetailPage.CollapsedPaneWidth method is used to specify the width of a partially collapsed navigation bar.

The result is that a specified CollapseStyle is applied to the MasterDetailPage instance, with the width also being specified: