File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/MaterialDesignThemes.Wpf Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -358,7 +358,14 @@ private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObj
358358 }
359359
360360 //NB: _dialogTaskCompletionSource is only set in the case where the dialog is shown with Show
361- dialogHost . _dialogTaskCompletionSource ? . TrySetResult ( closeParameter ) ;
361+ if ( dialogHost . _dialogTaskCompletionSource is { } taskCompletionSource )
362+ {
363+ Task . Run ( async ( ) =>
364+ {
365+ await Task . Delay ( 400 ) ; // Wait for the closing animation to finish before completing the DialogHost.Show() task.
366+ taskCompletionSource . TrySetResult ( closeParameter ) ;
367+ } ) ;
368+ }
362369
363370 // Don't attempt to Invoke if _restoreFocusDialogClose hasn't been assigned yet. Can occur
364371 // if the MainWindow has started up minimized. Even when Show() has been called, this doesn't
You can’t perform that action at this time.
0 commit comments