@@ -32,8 +32,7 @@ public class DialogHost : ContentControl
3232
3333 private Popup _popup ;
3434 private Window _window ;
35- private DialogClosingEventHandler _attachedDialogClosingEventHandler ;
36- private bool _removeContentOnClose ;
35+ private DialogClosingEventHandler _attachedDialogClosingEventHandler ;
3736 private object _closeDialogExecutionParameter = null ;
3837
3938 static DialogHost ( )
@@ -85,7 +84,6 @@ public static async Task<object> Show(object content, object dialogIndetifier, D
8584
8685 await task ;
8786
88- targets [ 0 ] . DialogContent = null ;
8987 targets [ 0 ] . _asyncShowClosingEventHandler = null ;
9088
9189 return targets [ 0 ] . _closeDialogExecutionParameter ;
@@ -126,11 +124,6 @@ private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObj
126124 {
127125 dialogHost . _asyncShowWaitHandle . Set ( ) ;
128126 dialogHost . _attachedDialogClosingEventHandler = null ;
129- if ( dialogHost . _removeContentOnClose )
130- {
131- dialogHost . DialogContent = null ;
132- dialogHost . _removeContentOnClose = false ;
133- }
134127 return ;
135128 }
136129
@@ -257,7 +250,6 @@ private void OpenDialogHandler(object sender, ExecutedRoutedEventArgs executedRo
257250 {
258251 AssertTargetableContent ( ) ;
259252 DialogContent = executedRoutedEventArgs . Parameter ;
260- _removeContentOnClose = true ;
261253 }
262254
263255 SetCurrentValue ( IsOpenProperty , true ) ;
@@ -268,9 +260,9 @@ private void OpenDialogHandler(object sender, ExecutedRoutedEventArgs executedRo
268260 private void AssertTargetableContent ( )
269261 {
270262 var existindBinding = BindingOperations . GetBindingExpression ( this , DialogContentProperty ) ;
271- if ( existindBinding != null || DialogContent != null )
263+ if ( existindBinding != null )
272264 throw new InvalidOperationException (
273- "Content cannot be passed to a dialog via the OpenDialog of DialogContent is already set, or has a binding." ) ;
265+ "Content cannot be passed to a dialog via the OpenDialog if DialogContent already has a binding." ) ;
274266 }
275267
276268 private void CloseDialogHandler ( object sender , ExecutedRoutedEventArgs executedRoutedEventArgs )
0 commit comments