I would like to implement the multi-screen return function if I select the master of the hierarchy and make the selection in the last tier.
For the time being, I have written it as below.
//3 Back to Screen
Navigation.PopAsync(false).Wait(1);
Navigation.PopAsync(false).Wait(1);
Navigation.PopAsync(false).Wait(1);
I think there might be a better way to do it, but if anyone knows, please let me know.
xamarin
Basically, Navigation.PopAsync()
3 times is fine, but Task.Wait(1)
does not guarantee completion, so just Wait()
or
attach async voidSomeMethod()//async
{
wait Navigation.PopAsync(false);
wait Navigation.PopAsync(false);
wait Navigation.PopAsync(false);
}
Asynchronous methods should be used as shown in .
You can also use PopToRootAsync
if the transition target is a route page.
Or you can delete the history in advance.
voidSomeMethod()
{
Navigation.RemovePage (Navigation.NavigationStack [Navigation.NavigationStack.Count-2]);
Navigation.RemovePage (Navigation.NavigationStack [Navigation.NavigationStack.Count-2]);
Navigation.PopAsync (false);
}
© 2024 OneMinuteCode. All rights reserved.