Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to call previous page from current page using NavigationStack in Xamarin Forms?

$
0
0

why i am not able to call previous page from current displaying page using NavigationStack?
I have a code

    List<Page> li = Navigation.NavigationStack.ToList();
    Page last = li.ElementAt(li.Count - 2);  //This line give me the page to go back
    Navigation.PushAsync(last);   //This line gives me an error of 'Page must not already have a parent.'

and if i try to add

List<Page> li = Navigation.NavigationStack.ToList();
Page last = li.ElementAt(li.Count - 1);
 Navigation.RemovePage(last);

This above code throws me to main page but not to previous page
Please help


Viewing all articles
Browse latest Browse all 204402

Trending Articles