Forum Xamarin.Forms


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

How to get the Current Page Name in Tabbed Page

How to get the Current Page Name in Tabbed Page
1. A tabbed Page Two Tabb's where Both refers to the same Content Page with Two instance

I am trying to basically make IsVisible check while binding an element in Content Page based on which Page is in View


  • AdamPAdamP AUUniversity ✭✭✭✭✭

    @Scorpian1990 - The TabbedPage has a CurrentPage property that gets the current page. The only way to distinguish which one is which is either by adding a custom property to the pages.

    e.g. you can get both pages to inherit from a new base class that inherits from ContentPage and add in the property PageId.

    But I am thinking the better approach would be triggering an event from the OnAppearing() function on the actual page to do something. Though be warned that WinPhone acts a little different (

  • MikeDennisMikeDennis USMember ✭✭
    edited January 2016

    @AdamP tried to implement and totally confused, can you share me any working example?

  • JohnSmith.0620JohnSmith.0620 USMember ✭✭

    This is probably a little late, but for the benefit of anyone else finding this page, below is a super-simple example code:

    In your TabbedPage, put the following:

    string currentPageName = "";
    protected override void OnCurrentPageChanged()
        currentPageName = CurrentPage.Title;

    Every time the page changes, currentPageName gets assigned the new page's title. Within OnCurrentPageChanged(), I guess you can change whatever needs to change. For example, I change the ToolbarItems depending on which tab I have selected.

Sign In or Register to comment.