@@ -368,12 +368,15 @@ private void HandleMaximize()
368
368
var width = rect . Width ;
369
369
var height = rect . Height ;
370
370
371
- // Z-Order would only get refreshed/reflected if clicking the
372
- // the titlebar (as opposed to other parts of the external
373
- // window) unless I first set the window to HWND_BOTTOM then HWND_TOP before HWND_NOTOPMOST
374
- UnsafeNativeMethods . SetWindowPos ( this . handle , Constants . HWND_BOTTOM , left , top , width , height , Constants . TOPMOST_FLAGS ) ;
375
- UnsafeNativeMethods . SetWindowPos ( this . handle , Constants . HWND_TOP , left , top , width , height , Constants . TOPMOST_FLAGS ) ;
376
- UnsafeNativeMethods . SetWindowPos ( this . handle , Constants . HWND_NOTOPMOST , left , top , width , height , Constants . TOPMOST_FLAGS ) ;
371
+ // #2780 Don't blindly set the Z-Order to HWWND_NOTOPMOST. If this window has an owner, set
372
+ // the Z-Order to be after the owner. This keeps external dialogs appearing correctly above
373
+ // their owner window even when owner window is maximized and ignoring taskbar.
374
+ IntPtr hwndInsAfter = Constants . HWND_NOTOPMOST ;
375
+ if ( this . AssociatedObject . Owner != null )
376
+ {
377
+ hwndInsAfter = new WindowInteropHelper ( this . AssociatedObject . Owner ) . Handle ;
378
+ }
379
+ UnsafeNativeMethods . SetWindowPos ( this . handle , hwndInsAfter , left , top , width , height , 0x0040 ) ;
377
380
}
378
381
}
379
382
0 commit comments