Browse Source

fallback from CenterOwner to CenterScreen when owner is null

pull/8995/head
Tiago Conceição 4 years ago
parent
commit
1f05ee41bb
  1. 7
      src/Avalonia.Controls/Window.cs

7
src/Avalonia.Controls/Window.cs

@ -830,10 +830,11 @@ namespace Avalonia.Controls
var startupLocation = WindowStartupLocation;
if (startupLocation == WindowStartupLocation.CenterOwner &&
Owner is Window ownerWindow &&
ownerWindow.WindowState == WindowState.Minimized)
(Owner is null ||
(Owner is Window ownerWindow && ownerWindow.WindowState == WindowState.Minimized))
)
{
// If startup location is CenterOwner, but owner is minimized then fall back
// If startup location is CenterOwner, but owner is null or minimized then fall back
// to CenterScreen. This behavior is consistent with WPF.
startupLocation = WindowStartupLocation.CenterScreen;
}

Loading…
Cancel
Save