13
votes

How could I detect tab was touched in xamarin forms TabbedPage? (which is different from page changed detection which I figured how to detect)

Here is why: I'm trying to work around a rather ugly tabbed page overflow UI (the ugly scroller that shows up on the right over the tabbar whenever there are >5 tabs) So the 5th tab press shows a custom menu, second press hides that menu, etc.

Thanks!

1
same problem. can you give your answer.Ranjith Kumar

1 Answers

29
votes

If you are trying to find which page is selected in TabbedPage you could do it in this way. With Index value you can perform whatever action you want..

Event for detecting page no:

    this.CurrentPageChanged += (object sender, EventArgs e) => {
            var i = this.Children.IndexOf(this.CurrentPage);
            System.Diagnostics.Debug.WriteLine("Page No:"+i);
        };