@@ -235,6 +235,7 @@ private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObj
235
235
dialogHost . _attachedDialogClosingEventHandler = null ;
236
236
dialogHost . _session . IsEnded = true ;
237
237
dialogHost . _session = null ;
238
+
238
239
return ;
239
240
}
240
241
@@ -252,10 +253,17 @@ private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObj
252
253
dialogHost . DialogOpenedCallback ? . Invoke ( dialogHost , dialogOpenedEventArgs ) ;
253
254
dialogHost . _asyncShowOpenedEventHandler ? . Invoke ( dialogHost , dialogOpenedEventArgs ) ;
254
255
255
- dialogHost . Dispatcher . BeginInvoke ( DispatcherPriority . Loaded , new Action ( ( ) =>
256
+ dialogHost . Dispatcher . BeginInvoke ( DispatcherPriority . Background , new Action ( ( ) =>
256
257
{
257
- dialogHost . _popup ? . Child ? . Focus ( ) ;
258
- dialogHost . _popup ? . Child ? . MoveFocus ( new TraversalRequest ( FocusNavigationDirection . Next ) ) ;
258
+ var child = dialogHost . _popup ? . Child ;
259
+ if ( child == null ) return ;
260
+
261
+ child . Focus ( ) ;
262
+ child . MoveFocus ( new TraversalRequest ( FocusNavigationDirection . Next ) ) ;
263
+
264
+ //https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/issues/187
265
+ //totally not happy about this, but on immediate validation we can get some wierd looking stuff...give WPF a kick to refresh...
266
+ Task . Delay ( 300 ) . ContinueWith ( t => child . Dispatcher . BeginInvoke ( new Action ( ( ) => child . InvalidateVisual ( ) ) ) ) ;
259
267
} ) ) ;
260
268
}
261
269
@@ -498,8 +506,8 @@ private void OpenDialogHandler(object sender, ExecutedRoutedEventArgs executedRo
498
506
499
507
DialogContent = executedRoutedEventArgs . Parameter ;
500
508
}
501
-
502
- ValidationAssist . SetSuppress ( _popupContentControl , false ) ;
509
+
510
+ SetCurrentValue ( IsOpenProperty , true ) ;
503
511
504
512
executedRoutedEventArgs . Handled = true ;
505
513
}
0 commit comments