Xamarin - Change tabbed page from button

xamarin tabbed page
xamarin forms tabbed page change tab programmatically
xamarin forms tabbed page title
xamarin forms tabs in content page
xamarin forms tabbedpage icons
xamarin forms tabbed page events
xamarin tabbar
xamarin forms tabbed page navigation

I was currently working with Tabbed Page :

<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:me="clr-namespace:Let_s_go_out.Views.Pages;assembly=Let_s_go_out"
             x:Class="Let_s_go_out.Views.MainPage"
             >
  <TabbedPage.Children >
    <me:PlacesList />

    <me:PlaceSearch />


  </TabbedPage.Children>
</TabbedPage>

And in the PlaceSearch content I have a button :

<StackLayout Grid.Row="9" Orientation="Horizontal" >
          <Button Text="Rechercher" HorizontalOptions="Center" VerticalOptions="Center" Command="{Binding Search}"></Button>         
        </StackLayout>

So my question is : How I can go on the "PlaceList" Tabbed page when the Button is clicked ?

Thanks :)

You can use MVVM and MessagingCenter for this as well.

View:

public partial class AwesomeView : TabbedPage
{
    public AwesomeView()
    {
        InitializeComponent();
        BindingContext = new AwesomeViewModel();
    }

    protected override void OnAppearing()
    {
        MessagingCenter.Subscribe<AwesomeViewModel, int>(this, "SetActiveTab", (sender, index) => {
            CurrentPage = Children[index];
        });
    }

    protected override void OnDisappearing()
    {
        MessagingCenter.Unsubscribe<AwesomeViewModel>(this, "SetActiveTab");
    }
}

ViewModel:

public class AwesomeViewModel
{
    public ICommand GoToTabCommand { get; set; }

    private AwesomeViewModel()
    {
        InitCommands();
    }

    private void InitCommands()
    {
        GoToTabCommand = new Command(GoToTab);
    }

    private void GoToTab()
    {
       MessagingCenter.Send<AwesomeViewModel, int>(this, "SetActiveTab", 1); //REPLACE 1 with the index of your tab
    }
}

You just have to bind GoToTabCommand command to a button or any control you want.

I recommend having a constant instead of "SetActiveTab".

How to switch to the next tab of the TabbedPage on clicking button , Listen for the ListView.ItemSelected event and forward it to your TabbedPage. You can change the current active page using the TabbedPage. I created Tabbed page and it's children from XAML, and how can I access the tabbed page from any other child page to navigate to another child page on button click? I have tried giving x:Name property to the page, but not successful. Thanks! Yousuf.

The answer is Here :

https://forums.xamarin.com/discussion/comment/150973#Comment_150973

This could help other people :)

Change Tabbed Page From Button — Xamarin Community Forums, 2015 in Xamarin.Forms. Hello,. I was currently working with Tabbed Page : <? xml version="1.0" encoding="utf-8" ?> <TabbedPage� For more information about using image resources in Xamarin.Forms, check out the handy image guide on the Xamarin Developer Portal. Switching Tabs By Index. Your users can always switch tabs by tapping them. To switch the selected tab programmatically, you simply change the CurrentPage property of your TabbedPage. CurrentPage = Children[1];

Change the index according to your need

private void FAB_Clicked(object sender, EventArgs e)
{
    var tab = this.Parent.Parent as TabbedPage;
    tab.CurrentPage = tab.Children[2];            
}

Xamarin.Forms: Switching TabbedPage Tabs Programmatically , iOS Switch Tabs and Push Page via button click. Sometimes, your app uses tabs to separate different user activities. Sometimes, though, those� The steps given below are required to be followed in order to navigate from one page to another page in Xamarin.Forms, using Visual Studio. Step 1 Click File--> select New--> select Project.

Xamarin.Forms TabbedPage, On Android, the list of tabs appears at the top of the screen, and the detail area is below. Each tab consists of a title and an icon, which should be� I've seen this question asked a couple times before but I haven't found a solution that works for me. I have a code generated TabbedPage that uses a custom renderer in order to place icons on the tabs.

TabbedPage Class (Xamarin.Forms), _TabbedPageRenderer))] public class TabbedPage : Xamarin.Forms. On Android and Windows phones, the tabs appear across the top of the screen. The user Presents an alert dialog to the application user with a single cancel button . In a TabbedPage, each Page object is created when the TabbedPage is constructed. This can lead to a poor user experience, particularly if the TabbedPage is the root page of the application. However, Xamarin.Forms Shell enables pages accessed through a tab bar to be created on demand, in response to navigation.

Xamarin.Forms - Bottom TabbedPage in Android, how to Change Tabbed Page Top to Bottom for Android Device in Xamarin. Forms. Click the "Play" button to try it out. Wow, It's Working. Uses of a tabbed page. Access multiple pages by a single page; Navigation between pages becomes easier; More amount of information is shown on a page. Easy to use; One of the most used tabbed page applications is “Instagram”. Creating a tabbed page. Here, I am using Visual Studio 2017 for Windows OS with Xamarin workload installed in it.