Hello,
Welcome to our Microsoft Q&A platform!
ShowPopupAsync
can return a value to the caller
var result = await Navigation.ShowPopupAsync(popup);
whatever parameter is passed to Dismiss(backValue)
will be returned to the caller.
Here is my code in ViewModel
async void PerformShowPopup() {
// var res=await Navigation.ShowPopup();
// Get the value from the popup page
var result = await Navigation.ShowPopupAsync(new Popup01());
await Application.Current.MainPage.DisplayAlert("i",result.ToString(),"OK");
}
Here is my background code of popup page.
public partial class Popup01 : Popup
{
public Popup01()
{
InitializeComponent();
}
private void Button_Clicked(object sender, EventArgs e) => Dismiss(null);
private void Button_Clicked_1(object sender, EventArgs e)
{
//return the value
Dismiss(editor_value.Text);
}
}
Here is my running screenshot.
Best Regards,
Leon Lu
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.