Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I detect tab was touched in xamarin forms TabbedPage

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!

like image 604
Anton Tropashko Avatar asked Aug 12 '15 09:08

Anton Tropashko


1 Answers

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);
        };
like image 170
Femil Shajin Avatar answered Oct 03 '22 01:10

Femil Shajin