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

前端 未结 3 460
小蘑菇
小蘑菇 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:13

    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
    

提交回复
热议问题