The excellent solution from @DiamondKesha does not handle if the user cancels the popup using the Android back button. If you don't care about that then you could simply disable that functionality by setting IsLightDismissEnabled
to false. If you do care then you'll want to override the LightDismiss
method in your popup, then set the TaskCompletionSource as cancelled (and catch the OperationCanceledException) or complete depending on your needs.
protected override void LightDismiss()
{
ViewModel.PopupResult.TrySetCanceled();
base.LightDismiss();
}