diff --git a/DialogHost.Avalonia/DialogHost.axaml.cs b/DialogHost.Avalonia/DialogHost.axaml.cs index 56e00bf..2f8fe5d 100644 --- a/DialogHost.Avalonia/DialogHost.axaml.cs +++ b/DialogHost.Avalonia/DialogHost.axaml.cs @@ -788,8 +788,6 @@ public void RemoveDispose(DialogOverlayPopupHost host) { } private void RemoveHost(DialogOverlayPopupHost host) { - //NB: _dialogTaskCompletionSource is only set in the case where the dialog is shown with Show - host.DialogTaskCompletionSource.TrySetResult(host.Session.CloseParameter); host.IsOpen = false; host.Content = null; @@ -800,6 +798,8 @@ private void RemoveHost(DialogOverlayPopupHost host) { if (_overlayPopupHosts.Count == 0) { SetAndRaise(IsOpenProperty, ref _isOpen, false); } + + host.DialogTaskCompletionSource.TrySetResult(host.Session.CloseParameter); } private void ContentCoverGrid_OnPointerReleased(object sender, PointerReleasedEventArgs e) {