Transfer Information from One View to Another

Asked

Viewed 62 times

2

Good afternoon! I came across a question, I am developing a project Xamarin Forms Shared, using MVVM standard, in a certain View Model1 linked to View1, when performing a search and existing the value in the local bank, the View Model1 Calls the View2. So far so good, my doubt is how to pass these values researched in View1 to View2. This was a way that I found to solve in parts this question, because the search performed by the barcode of a product, checks in the bank if the product exists, if it exists, returns the Name and the value of it, would like to bring this information in a second View where you can add also the amount of items I want and return a sum of how much it will cost.

  • About the posted doubt, instead of passing the information from one screen to another, I decided to insert directly into the database. On the other screen, I just retrieve this information and make the missing insertions. As a solution to what I had requested, I was instructed to use the mesenging Center. I have not tested this to see how much is valid, but if anyone needs it, you may be checking: https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/messaging-center/.

  • You can pass the object in the view constructor as well. The messaging center is interesting when you want information from one screen to be used in another, for example... About your solution, I would advise you to consider whether this is the best strategy, since if the app is closed after you exit the first screen, you will have an inconsistent record in the bank

No answers

Browser other questions tagged

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