I am using .NET MAUI Navigation page for navigating between pages.
Splash Page ,
1st Page ,
2nd Page ,
3rd Page ,
4th Page ,
5th Page ,
6th Page ,
7th Page ,
8th Page ,
9th Page ,
10th Page ,
On 10th page i print the Navigation.Navigationstack.Count(); then i get 10.
now i want to navigate back to my 3rd Page directly from my 10th page .
How can i do this? If anyone knows please help .
I am trying this but it’s not working.
int page = Navigation.NavigationStack.ToList().FindIndex(p => p is Thirdpage);
if (page >= 0)
{
for (int i = Navigation.NavigationStack.Count - 1; i > page; i--)
{
var pageToRemove = Navigation.NavigationStack[i];
Navigation.RemovePage(pageToRemove);
}
while (Navigation.NavigationStack.Count > page + 1)
{
await Navigation.PopAsync(false);
}
}
else
{
Console.WriteLine("Third Page not found in the navigation stack!");
}
New contributor
ibs mdmosabbir is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.