Forum Xamarin Cross Platform with Xamarin

Flow Direction

Hi,
i would like to ask about the flow direction of the tabbed pages tab bar...
i want to start the app with the tab at the far right side showing first
so i tried the following:
1. changing the Flowdirection property to Right to left
witch resulted in the title of the page changing directions but not the tab bar
2. changing the CurrentPage property at the start of the app
witch resulted in selecting the wanted tab while its not visible
in other words it selected the tab and scrolled to the far left of the tab bar...

Best Answer

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    If you only want to set the start page to the last tab, you could try the code below:

    public MyTabbedPage()
    {
        InitializeComponent();
    
        CurrentPage = Children.LastOrDefault();
    }
    

    If you want to change the gesture direction we need to disable the default effect of the tabbed page on Android:

    this.On<Xamarin.Forms.PlatformConfiguration.Android>().SetIsSwipePagingEnabled(false);
    

    Then implement your own gestures to achieve the custom swipe.

  • aga913aga913 Member ✭✭✭

    @LandLu said:
    If you only want to set the start page to the last tab, you could try the code below:

    public MyTabbedPage()
    {
        InitializeComponent();
    
        CurrentPage = Children.LastOrDefault();
    }
    

    i do but the thing is:
    the app is starting, the wanted page is selected, but the tabbar is scrolled way to the other side so you don't even see the selected tab & you have to scroll to the right side again so you can see the selected tab...
    Note: my tabbar is scrollable if i didn't make it clear

  • aga913aga913 Member ✭✭✭

    thanks for your respond,
    i think this will do the trick for me but is there a non custom render solution ?
    because the tabbar have the scrollable attribute in the Tabbar.axml file
    so i thought there would be a way to simply scroll through it.

  • LandLuLandLu Member, Xamarin Team Xamurai

    No, we can't.
    We still need to add some code to programmatically scroll it due to your real tab items.
    Tabbar.axml is only an appearance template for your Forms. We could configure the tint color, item size or other appearance properties there.

Sign In or Register to comment.