Bug 52374 - IsVisible Doesn't Hide Tabs in TabbedPage
Summary: IsVisible Doesn't Hide Tabs in TabbedPage
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: unspecified
Hardware: PC Windows
: --- enhancement
Target Milestone: ---
Assignee: Jimmy [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-02-08 05:01 UTC by Melbourne Developer
Modified: 2017-07-19 23:34 UTC (History)
4 users (show)

Tags:
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:
Status:
RESOLVED ANSWERED

Description Melbourne Developer 2017-02-08 05:01:16 UTC
In our app, we need to load a set of tabs up in to a TabbedPage, and then toggle the visibility of each tab given some criterion. However, setting the IsVisible flag on a give Page (ContentPage) in this case doesn't hide the tab. It hides the Content of the tab, but the Title of the ContentPage is left in the set of tabs. This should be made invisible when the ContentPage has its IsVisible property set to false.

In order to recreate the problem, please clone this repo, and run one of the samples (UWP or Android - iOS not tested):
https://ChristianFindlay@bitbucket.org/ChristianFindlay/xamarin-forms-scratch.git

Click on the button "Invisible Panels". You will notice that it displays 3 tabs, and none of the tabs have content. However, the IsVisible property of each tab (ContentPage) has been set to false so the tabs' Title should not display.
Comment 1 Jimmy [MSFT] 2017-03-08 19:22:23 UTC
I believe I was able to reproduce this with the project linked to in the description. When IsVisible = false on a child tab page the content was hidden, but the tab itself was not so it was still possible to navigate/swipe to it.

I tested this on iOS, Android, and UWP and the behavior described above was consistent across all platforms. This would indicate that the IsVisible property is not currently utilized to determine if the tab should be present or removed. In this case, this issue can be classified as an enhancement request and would be best suited as a UserVoice suggestion[1] or a proposal in our Evolution forum[2] for future consideration.

For now, in order to remove the title and the tab you will have to remove the page from TabbedPage.Children. If using XAML, you may be able to create a bindable property in your children pages that will handle this when the property is changed[3].


[1] https://xamarin.uservoice.com/forums/144858-xamarin-platform-suggestions
[2] https://forums.xamarin.com/categories/xamarin-forms-evolution
[3] https://developer.xamarin.com/guides/xamarin-forms/xaml/bindable-properties/
Comment 2 Shimmy 2017-07-19 15:45:53 UTC
Same here
Annoying issue, especially when using MVVM.
Comment 3 Melbourne Developer 2017-07-19 23:28:57 UTC
Thanks Jimmy. Yes, you have grasped the issue.

We have worked around the problem in the way that you have described, but it is non standard behaviour for a tab based control.
Comment 4 Shimmy 2017-07-19 23:34:27 UTC
And btw, I tried creating a behavior that is attached to the IsVisibile property (via PropertyChanged event), but I couldn't get it to work.

@Melbourne, can you please share your workaround?