Carlos Henrique
Carlos Henrique

Reputation: 373

how to switch ContentPage to another ContentPage

I Have One Page That is "Category", if you select one, are going to "SubCategories" of that selected category, and finnaly if you select one Sub, needs to switch to anoter ContetPage which is not in the context of categories, that is, I have to kill the category and subcategory screen and trigger the other screen that I need

I Tried it

void OnItemTapped(Object sender, ItemTappedEventArgs e)
    {
        var dataItem = (SubCategoria)(e.Item);

        App.TodosOutrosFiltros.IdSubCategoria = dataItem.IdSubCategoria;

        _navigationService.PopModalAsync();
    }

but he just went back to the category, could anyone help me?

Upvotes: 0

Views: 55

Answers (1)

micael cunha
micael cunha

Reputation: 513

You can go to the root if your "Category" is the root

_navigationService.PopToRootAsync();

Or you can remove the pages you want like this:

this.Navigation.RemovePage (this.Navigation.NavigationStack [this.Navigation.NavigationStack.Count - 2]);

this will remove the number of pages that you want from the stack, and then you can "Pop" like you are doing

Upvotes: 1

Related Questions