@@ -68,9 +68,7 @@ public class DialogHost : ContentControl
68
68
private DialogOpenedEventHandler _attachedDialogOpenedEventHandler ;
69
69
private DialogClosingEventHandler _attachedDialogClosingEventHandler ;
70
70
private IInputElement _restoreFocusDialogClose ;
71
- private IInputElement _restoreFocusWindowReactivation ;
72
71
private Action _currentSnackbarMessageQueueUnPauseAction ;
73
- private Action _closeCleanUp = ( ) => { } ;
74
72
75
73
static DialogHost ( )
76
74
{
@@ -241,7 +239,6 @@ private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObj
241
239
242
240
if ( dialogHost . IsOpen )
243
241
{
244
- WatchWindowActivation ( dialogHost ) ;
245
242
dialogHost . _currentSnackbarMessageQueueUnPauseAction = dialogHost . SnackbarMessageQueue ? . Pause ( ) ;
246
243
}
247
244
else
@@ -254,7 +251,6 @@ private static void IsOpenPropertyChangedCallback(DependencyObject dependencyObj
254
251
}
255
252
dialogHost . CurrentSession . IsEnded = true ;
256
253
dialogHost . CurrentSession = null ;
257
- dialogHost . _closeCleanUp ( ) ;
258
254
//NB: _dialogTaskCompletionSource is only set in the case where the dialog is shown with Show
259
255
//To get into this case you need to display the dialog with Show and then hide it by setting IsOpen to false
260
256
//Setting this here ensures the other
@@ -627,7 +623,7 @@ internal UIElement FocusPopup()
627
623
628
624
return child ;
629
625
}
630
-
626
+
631
627
protected override void OnPreviewMouseDown ( MouseButtonEventArgs e )
632
628
{
633
629
var window = Window . GetWindow ( this ) ;
@@ -712,39 +708,5 @@ private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
712
708
LoadedInstances . Add ( this ) ;
713
709
}
714
710
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
- }
749
711
}
750
712
}
0 commit comments