Tabbed Page on iOS: how to check the click on the "more" button?

LauraGrossoLauraGrosso ITMember, University
edited July 2014 in Xamarin.Forms

Hi,

When there are more than five items in a tabbed page (I tested the gallery one), iOS shows a "more" button. However, clicking it does nothing and I have not found a way to check it when it is clicked.
the documentation does not indicate a lot... http://iosapi.xamarin.com/?link=T:Xamarin.Forms.TabbedPage/*

Any suggestions?

public TabbedPageDemoPage()
{
this.Title = "TabbedPage";

            this.ItemsSource = new NamedColor[] 
            {
                new NamedColor("Red", Color.Red),
                new NamedColor("Yellow", Color.Yellow),
                new NamedColor("Green", Color.Green),
                new NamedColor("Aqua", Color.Aqua),
                new NamedColor("Blue", Color.Blue),
                new NamedColor("Purple", Color.Purple),
                new NamedColor("Olive", Color.Olive)

            };

            this.ItemTemplate = new DataTemplate(() => 
                { 
                    return new NamedColorPage(false); 
                });
        }

In the screenshot, you can see the button that doesn't click.
thanks!

Posts

  • CraigDunnCraigDunn USXamarin Team Xamurai

    Not sure what's happening in your example, but when I add additional tabs to the WorkingWithImages sample it works fine - as expected the More button displays a list of the additional tabs, and each one can be selected as though chosen from the tab bar.

    There is nowhere in the Xamarin.Forms API to 'detect' when the More button is clicked, this is taken care of by iOS.

  • LauraGrossoLauraGrosso ITMember, University
    edited July 2014

    Hi Craig, thanks for the different example..

    The one I posted is actually not my example :) it is in the Xamarin Forms API.

    When you click on "more" in the API example, the first button is clicked again, automatically. There is no "extra" menu for more.

    I think the TabbedPage "more" button only works if its children are pages, not if they are NamedColors as in the sample.

  • CraigDunnCraigDunn USXamarin Team Xamurai

    I think the TabbedPage "more" button only works if its children are pages, not if they are NamedColors as in the sample.

    yeah, it does seem like there's a problem with the More button in this case. Raised for investigation.

  • @CraigDunn‌ , is there any solution for this problem?

    cc @LauraGrosso‌

  • My humble opinion: it is the sample with NamedColors (contained in the Xamarin docs) which is a bit unrealistic.

    I think that 99% of the cases are like those in which the items of the tabbed page are actually pages...

    It is not a color selector. It is a view (or fragment, in Android's case) selector.

  • Thanks @RiccardoMantegazzini‌, I found a way to fix my code by minimum changes.

             var myPages =  new NamedColor[] 
                        {
                            new NamedColor("Red", Color.Red),
                            new NamedColor("Yellow", Color.Yellow),
                            new NamedColor("Green", Color.Green),
                            new NamedColor("Aqua", Color.Aqua),
                            new NamedColor("Blue", Color.Blue),
                            new NamedColor("Purple", Color.Purple),
                            new NamedColor("Olive", Color.Olive)
    
                        };
    
        //add these items as Children to the TabbedPage and set the BindingContext
               foreach (var item in myPages)
               {
                 this.Children.Add(new NamedColorPage(false){ BindingContext = item});
               }
    

    Full code: https://gist.github.com/kirtisagar/ade2a207d759f4ab800c

    cc: @LauraGrosso‌ , @CraigDunn‌

  • there is one more bug attached to this, in More page on item click SelectedTab event not raised. any update on this bug @CraigDunn‌ ?

  • CraigDunnCraigDunn USXamarin Team Xamurai

    I have no information about where this is at unfortunately. The best way to stay informed about bugs is to add your email address to the bug in bugzilla. The team update bug status when they work on them, and subscribed email addresses will get a notification. It's impossible to go back and update all the forum posts that discuss various issues.

  • steveleonardsteveleonard USMember ✭✭

    @CraigDunn I'm having the same issue with the tabbed page not opening the pages shown in the more list as @kirti described 'More page on item click SelectedTab event not raised'

    Is there a bugzilla link for this? This thread is quite old and the bugs still not fixed.

  • Daniel_EDaniel_E FRMember ✭✭

    I still have the issue on my side. I don't know if it is supposed to be solved.

    This is part of my code
    public class MyTabbedPage: TabbedPage { private MyTabbedPage() { SetBinding(ItemsSourceProperty, Binding.Create<MyViewModel>(src => src.MyList)); ItemTemplate = new DataTemplate(typeof(MyListTemplate)); } } public class MyListTemplate: ContentPage { public MyListTemplate() { SetBinding(TitleProperty, Binding.Create<MyModel>(src => src.Date, BindingMode.Default, DateFormatConverter, "dd MMM")); var stackLayout = new StackLayout { Children = { DateLabel("dddd dd MMMM")}, }; Content = stackLayout; } }

  • GB.9334GB.9334 USMember

    Hi - Any update on this issue? On iOS "More" option does not work as expected. Is their a workaround that we can use?

  • EricHoffmanEricHoffman USMember

    I'm seeing this is still an issue on iOS, but it's happening even if the tabs contain pages as apposed to colors. I setup a TabbedPage, which binds to a list of tabs and displays a ContentPage for each via TabbedPage.ItemTemplate => DataTemplate => ContentPage. (Like the MonkeyData sample app). My test app allows upto 9 tabs, which triggers the More... menu on iOS, but tapping it simply activates the first tab instead of showing the menu. UWP and Android versions seem to handle it fine.

Sign In or Register to comment.