How to pass a parameter from one Page to another Page in Xamarin.Forms?

前端 未结 3 496
小蘑菇
小蘑菇 2021-02-06 11:44

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

 
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-06 12:07

    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/

提交回复
热议问题