Browsing between Pages

Asked

Viewed 960 times

1

I’m making a sales order app with Xamarin, but I am with a problem, in flame ruma page search, and return the selected value to the page I was. I will explain further below.

Screen 1:

  • Order registration screen, on this screen, the operator type the client code, or click on a "magnifying glass" to open the customer listing screen, I’m using Navigation.Pushasync(telaPesquisa); to call the listing screen:

inserir a descrição da imagem aqui

Screen 2:

  • Customer listing screen, this screen displays registered customers, and when selecting a customer, and press OK, would have to return to "Screen 1", but is not returning. I am using Navigation.Popasync();

Could someone tell me how to do that? Basically, it’s open a search screen, select the client, and return to the current screen.

Att. Felipe

  • It would be good to put the code referring to Navigation.PushAsync(telaPesquisa)

  • 1

    That’s all I had in the code, so I didn’t. I was able to adjust here, it was my own mistake, the button event was "binded" twice, in the C# code and in the XAML code. That’s why Popasync didn’t work, it was going back 2 pages. Now it’s right. Thanks for the help @rubStackOverflow.

1 answer

2

Navigation in Xamarin using the instance of Inavigationservice uses a battery scheme to perform navigation. Inavigationservice has two stacks that keep the browsed pages: one for pages and one for modal. When we use Pushasync we insert a page in the stack of pages. 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 page and there is no modal.

The fix for your problem would be using Pushmodalasync instead of Pushasync .

Browser other questions tagged

You are not signed in. Login or sign up in order to post.