Forum Xamarin.Forms

Navigation and passing values back to a form

What I am trying to achieve :

So, you are on one xamarin form then navigating to a search form, then navigating to a selection form then after selecting going back to the origonal form - with the origonal form updating a field depending on what was selected on the third form.

How can I achieve this? Does anyone have an example of this that I can have a look at?

Many Thanks!


  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭


    You don't pass values to a form. Anything you ask after that is taking you down a bad direction.

    Forms don't have/hold values. Period. ViewModels have values/data. Forms are just a reflection of that data.... A way to interact with the data... Through DataBinding.

  • PeterSmith.3161PeterSmith.3161 USMember ✭✭

    Thanks for the reply.

    So, can I achieve this using databinding- navigating through 'Forms' with their 'ViewModel', basicaly selecting something on one 'Form' and it 'Binding' to another 'Form' and its 'View Model'? - This may seem a basic question, but this is new to me!


  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    You've lost me. I can't picture, what it is you're picturing, that you think is going to take place.

    Both forms can use the same ViewModel to simplify things for you.

    If you select something you are saying in the ViewModel SelectedWidget = blahblahObject
    You can then use that SelectedWidget from wherever you need to.

    If that's being done through a form, cool. If that's 10 forms all looking at the same SelectedWidget property on the same ViewModel... Cool.

  • PeterSmith.3161PeterSmith.3161 USMember ✭✭

    THANKS - Both forms can use the SAME ViewModel - I did not know that! - I am still getting to grips with the concepts.


  • ClintStLaurentClintStLaurent USUniversity ✭✭✭✭✭

    @PeterSmith.3161 said:
    THANKS - Both forms can use the SAME ViewModel - I did not know that! - I am still getting to grips with the concepts.

    Then I urge you to stop trying to design a program. If you don't know the foundation concepts how can you architect something? Take the time to just learn. Don't build. Work through a course like Xamarin University, or Charles Petzold's book. The time you spend learning will more than be made up for in the lost time trying to reverse engineer an understanding from banging on the keyboard and hoping Intellisense gives you something.

Sign In or Register to comment.