Bug 55610 - [UWP] Toolbar not shown when Detail or Master is a derived NavigationPage
Summary: [UWP] Toolbar not shown when Detail or Master is a derived NavigationPage
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.3.4
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Jimmy [MSFT]
Depends on:
Reported: 2017-04-26 08:18 UTC by Matthew Richardson
Modified: 2017-04-27 08:31 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Matthew Richardson 2017-04-26 08:18:17 UTC
PR #638 added the "ShouldShowToolbar" property inside MasterDetailPageRenderer.
This was subsequently updated in PR #744.

However, the following logic fails if either _detail or _master is a derived NavigationPage.

void UpdateToolbarVisibilty()
    // Enforce consistency rules on toolbar
    Control.ShouldShowToolbar = _detail is NavigationPage || _master is NavigationPage;

We were able to fix this by overriding the property in a custom renderer, but the logic should be able to handle a derived instance of NavigationPage.

ie. FooNavigationPage : NavigationPage will evaluate to false as it is a derived class.
Comment 1 Jimmy [MSFT] 2017-04-26 18:54:29 UTC
I wasn't able to reproduce this with a new project using The 'is' keyword is supposed to work for derived types as well so it's odd that you're seeing this. Can you attach a repro project so I can try confirming this? Thanks!
Comment 2 Matthew Richardson 2017-04-27 08:31:11 UTC
Hi Jimmy.

While attempting to create a repro project, we tracked down the cause of this issue. We are using a customized MasterDetailPageRenderer built off the base implementation and thus the new "UpdateToolbarVisibilty" method was not being called.

Our apologies for reporting a 'red herring'. We have this beefy custom implementation of MasterDetailPage which adds support for overlaying the toolbar, setting toggle button background colour etc and changes to renderer retention. Eventually we hope to ditch up, but in the meantime I just have to keep it in sync with the base implementation!

Many thanks once again.