I want to send a value when I press a button in a form to another form through the MVVM pattern.
This is the XAML file
Good example of passing parameters to ViewModel and getting result back: How do I pass entry parameters to Xamarin MVVM viewmodel
To navigate from ViewModel to next page (View):
await Xamarin.Forms.Application.Current.MainPage.Navigation.PushAsync(new MyView());
Use SQLite to store the object and instantiate it in the new ViewModel or use the messaging center built into Xamarin.Forms to pass data between ViewModels indirectly.
Jason's approach will work but personally passing data up to the view, to another view then back down to the view model is not something I want to do.
SQLite Documentation
http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/databases/
Messaging Center Documentation
http://developer.xamarin.com/guides/cross-platform/xamarin-forms/messaging-center/
The easiest approach would be to pass the value as a parameter to the constructor of Page2. Or you could create a public property on Page2 and assign the value to it after you create it.
await _navigation.PushAsync(new Page2(argument_goes_here)); // HERE