Bug 42344 - [Windows 8.1] Tabs are disappearing when one tabbed page is opening from other tabbed page.
Summary: [Windows 8.1] Tabs are disappearing when one tabbed page is opening from othe...
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: unspecified
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2016-07-04 11:55 UTC by Aleksandrs Vorobjovs
Modified: 2016-11-03 13:36 UTC (History)
3 users (show)

Tags: ac
Is this bug a regression?: No
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 for Bug 42344 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Aleksandrs Vorobjovs 2016-07-04 11:55:17 UTC
Xamarin.Forms application on the Windows 8.1 platform.
It is related to the Windows 8.1 platform only, not to the WinPhone 8.1.

Steps to reproduce:
1) Create an application with two (or more) tabbed pages.
2) Push one tabbed page from other tabbed page.

The bug:
When new tabbed page is opened, tabs on this page is not shown.
If go back to the parent tabbed page, tabs on the parent is also not shown.

The cause:
The root cause is the RemoveTabs() method implementation in the TabbedPageRenderer class of the Xamarin.Forms.Platform.WinRT.Tablet project.

A problem is that a parent page is disappearing after a new page is appearing.
So, the OnUnloaded() method of the TabbedPageRenderer class for the parent page is called after the OnLoaded() method of the TabbedPageRenderer class for the new page.
But the AppBar control on the Windows 8.1 is shared for all Xamarin.Forms pages, because pages are displayed in the single MainPage container.
So, when a new tabbed pages is appearing, the OnLoaded() method of the TabbedPageRenderer class is called, and it populates new tabs to the content of the shared AppBar.
But when (after this) a parent tabbed page is disappearing, the OnUnloaded() method of the TabbedPageRenderer class is called, and it clears the same content of the shared AppBar.

How to fix it:
Change a code of the RemoveTabs() method of the TabbedPageRenderer class to ensure that this method clears its own tabs only.

Existing code:
void RemoveTabs()
	var page = GetTopPage();
	if (page == null)

	// Explicitly unparent this.tabs so we can reuse
	if (page.TopAppBar != null)
		page.TopAppBar.Content = null;

	page.TopAppBar = null;

Fixed recommended code:
void RemoveTabs()
    var page = GetTopPage();
    if (page == null)

    // This part of code fixes an issue of tabs disappearing
    if (page.TopAppBar != null)
        if (page.TopAppBar.Content != null && _tabs != null &&
            (page.TopAppBar.Content as TabsControl) == _tabs)
            page.TopAppBar.Content = null;

        if (page.TopAppBar.Content == null)
            page.TopAppBar = null;
Comment 1 Aleksandrs Vorobjovs 2016-07-04 13:51:28 UTC
I have created a post in the Xamarin forum about this and explained this problem in other words.
Comment 2 Aleksandrs Vorobjovs 2016-07-05 21:34:56 UTC
Another issue related to this bug.

The Xamarin.Forms.Platform.WinRT.TabButton class explicitly refers to the Xamarin.Forms.Platform.WinRT.TabbedPageRenderer class.

It is a bad practice. It prevents of an inheritance of the TabbedPageRenderer class.
Would be better if the TabButton class refers to an interface.