Quick Links

Am I missing something re. Title properties when using MasterDetailPage?

When I started working with Xamarin.Forms, I found that MasterDetailPage did not do what I wanted and contained multiple bugs. I therefore wrote something to replace MasterDetailPage in my own code, to get the precise result I wanted.

I thought I'd take a peek at the current state of MasterDetailPage (using XF 2.4.0.38779) to see how it has changed since then.

"The MasterDetailPage.Master property is set to a ContentPage instance. The MasterDetailPage.Detail property is set to a NavigationPage containing a ContentPage instance."

and:

"The MasterDetailPage.Master page must have its Title property set, or an exception will occur."

Following those two guides, and using MasterBehavior.Split, I find that the Title set on the Master page is not displayed. It seems odd that setting it is required if it's not then displayed. Am I missing something?

Also, on that same page, it says:

"MasterDetailPage is designed to be a root page, and using it as a child page in other page types could result in unexpected and inconsistent behavior. In addition, it's recommended that the master page of a MasterDetailPage should always be a ContentPage instance, and that the detail page should only be populated with TabbedPage, NavigationPage, and ContentPage instances. This will help to ensure a consistent user experience across all platforms."

I find that if I use MasterDetailPage as a child page, on UWP the Detail page's Title is displayed twice. Must be one of those "unexpected and inconsistent behaviors". Seems odd though - if it was going to do something like that, I would have expected that to happen on Android and UWP as well. Makes me wonder if UWP is not kept quite up to date with Android and UWP when it comes to MasterDetailPage...

The good thing is that this latest dabble with MasterDetailPage makes me think creating my own replacement was the right thing to do, even if it took a fair amount of work.

For info, the hacky code I used whilst dabbling with this today is as follows:

So @NMackay, what you are saying is that this is a known implementation difference, not a bug?

Can you recommend an alternative method of a "navigation drawer" that works in XF?

I'm a new Xamarin developer, just getting my feet wet. I have to say I love the whole concept of using C# and Visual Studio, and the architecture looks well thought out. It's just that I can't get anything to work reliably. :-(