Navigation between Pages

1

I am making a sales order app with Xamarin , but I have a problem, call a search page, and return the selected value to the page I was on. I'll explain better below.

Screen 1:

  • Order registration screen, in this screen, the operator enters the client code, or click on a "little mirror" to open the client list screen, I am using Navigation.PushAsync (search screen); to call the list screen:

Screen2:

  • Clientlistscreen,thisscreendisplaystheregisteredclients,andwhenselectingaclient,andpressingOK,wouldhavetoreturnto"Screen 1", but it is not returning. I'm using Navigation.PopAsync ();

Can someone tell me how to do this? Basically, it is to open a search screen, select the client, and return to the current screen.

Att. Felipe

    
asked by anonymous 15.06.2016 / 13:35

1 answer

2

Navigating in Xamarin using the instance of INavigationService uses a stack scheme to perform navigation. The INavigationService has two cells that store the pages navigated: one for pages and one for modal. When we use PushAsync, we insert a page into the page stack. When we use PushModalAsync we insert a page in the modal stack and this page will be treated as modal ..

The PopAsync function is used to remove the last item that was inserted into the modal stack.

That way when you use PushAsync and then PopAsync nothing happens because the stack that was used was that of pages and there is no modal.

The fix for your problem would be to use PushModalAsync instead of PushAsync.

    
26.05.2017 / 18:52