Popup.ShowAsync()

public static Task ShowAsync(this Popup popup) {

    TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();

    EventHandler<object> onClosed = null;
    onClosed = (s, e) => {
        popup.Closed -= onClosed;
        tcs.SetResult(true);
    };
    popup.Closed += onClosed;
    popup.IsOpen = true;

    return tcs.Task;
}
Example:
private async void Button_Click(object sender, RoutedEventArgs e) {
    await this.popupTest.ShowAsync();
    (sender as Button).Content = "Closed at " + DateTime.Now.ToString("HH:mm:ss");
}

Description

Show an XAMP Popup using the async/await pattern instead of using the completed event.

Details

Double click on the code to select all.

 

;