@@ -68,9 +68,7 @@ public class DialogHost : ContentControl
6868 private DialogOpenedEventHandler _attachedDialogOpenedEventHandler ;
6969 private DialogClosingEventHandler _attachedDialogClosingEventHandler ;
7070 private IInputElement _restoreFocusDialogClose ;
71- private IInputElement _restoreFocusWindowReactivation ;
7271 private Action _currentSnackbarMessageQueueUnPauseAction ;
73- private Action _closeCleanUp = ( ) => { } ;
7472
7573 static DialogHost ( )
7674 {
@@ -241,7 +239,6 @@ private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObj
241239
242240 if ( dialogHost . IsOpen )
243241 {
244- WatchWindowActivation ( dialogHost ) ;
245242 dialogHost . _currentSnackbarMessageQueueUnPauseAction = dialogHost . SnackbarMessageQueue ? . Pause ( ) ;
246243 }
247244 else
@@ -254,7 +251,6 @@ private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObj
254251 }
255252 dialogHost . CurrentSession . IsEnded = true ;
256253 dialogHost . CurrentSession = null ;
257- dialogHost . _closeCleanUp ( ) ;
258254 //NB: _dialogTaskCompletionSource is only set in the case where the dialog is shown with Show
259255 //To get into this case you need to display the dialog with Show and then hide it by setting IsOpen to false
260256 //Setting this here ensures the other
@@ -627,7 +623,7 @@ internal UIElement FocusPopup()
627623
628624 return child ;
629625 }
630-
626+
631627 protected override void OnPreviewMouseDown ( MouseButtonEventArgs e )
632628 {
633629 var window = Window . GetWindow ( this ) ;
@@ -712,39 +708,5 @@ private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
712708 LoadedInstances . Add ( this ) ;
713709 }
714710
715- private static void WatchWindowActivation ( DialogHost dialogHost )
716- {
717- var window = Window . GetWindow ( dialogHost ) ;
718- if ( window != null )
719- {
720- window . Activated += dialogHost . WindowOnActivated ;
721- window . Deactivated += dialogHost . WindowOnDeactivated ;
722- dialogHost . _closeCleanUp = ( ) =>
723- {
724- window . Activated -= dialogHost . WindowOnActivated ;
725- window . Deactivated -= dialogHost . WindowOnDeactivated ;
726- } ;
727- }
728- else
729- {
730- dialogHost . _closeCleanUp = ( ) => { } ;
731- }
732- }
733-
734- private void WindowOnDeactivated ( object sender , EventArgs eventArgs )
735- {
736- _restoreFocusWindowReactivation = _popup != null ? FocusManager . GetFocusedElement ( ( Window ) sender ) : null ;
737- }
738-
739- private void WindowOnActivated ( object sender , EventArgs eventArgs )
740- {
741- if ( _restoreFocusWindowReactivation != null )
742- {
743- Dispatcher . BeginInvoke ( new Action ( ( ) =>
744- {
745- Keyboard . Focus ( _restoreFocusWindowReactivation ) ;
746- } ) ) ;
747- }
748- }
749711 }
750712}
0 commit comments