I did some quick testing with this and it seems to work. The source code for the control has
public virtual void OnCompleted(PopUpEventArgs<T, TPopUpResult> result)
{
this._alreadyFired = true;
if (this.Completed != null)
this.Completed((object) this, result);
if (this.PopUpService != null)
this.PopUpService.Hide();
if (this.PopUpService == null || !this.PopUpService.BackButtonPressed)
return;
this.ResetWorldAndDestroyPopUp();
}
Implying that you can overwrite the method.
So, create a class that inherits from the control
public class PasswordInputPromptOveride : PasswordInputPrompt
{
public override void OnCompleted(PopUpEventArgs<string, PopUpResult> result)
{
//Validate for empty string, when it fails, bail out.
if (string.IsNullOrWhiteSpace(result.Result)) return;
//continue if we do not have an empty response
base.OnCompleted(result);
}
}
In your code behind:
PasswordInputPrompt passwordInput;
private void PasswordPrompt(object sender, System.Windows.Input.GestureEventArgs e)
{
InitializePopup();
}
private void InitializePopup()
{
passwordInput = new PasswordInputPromptOveride
{
Title = "Application Password",
Message = "Please Enter App Password",
};
passwordInput.Completed += Pwd_Entered;
passwordInput.Show();
}
void Pwd_Entered(object sender, PopUpEventArgs<string, PopUpResult> e)
{
//You should ony get here when the input is not null.
MessageBox.Show(e.Result);
}
Xaml to trigger the password prompt
<Grid VerticalAlignment="Top" x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Button Content="ShowPasswordPrompt" Tap="PasswordPrompt"></Button>
</Grid>