private void SetWindowStartupLocation(IWindowBaseImpl owner = null) { var scaling = owner?.Scaling ?? PlatformImpl?.Scaling ?? 1; // TODO: We really need non-client size here. var rect = new PixelRect( PixelPoint.Origin, PixelSize.FromSize(ClientSize, scaling)); if (WindowStartupLocation == WindowStartupLocation.CenterScreen) { var screen = Screens.ScreenFromPoint(owner?.Position ?? Position); if (screen != null) { Position = screen.WorkingArea.CenterRect(rect).Position; } } else if (WindowStartupLocation == WindowStartupLocation.CenterOwner) { if (owner != null) { // TODO: We really need non-client size here. var ownerRect = new PixelRect( owner.Position, PixelSize.FromSize(owner.ClientSize, scaling)); Position = ownerRect.CenterRect(rect).Position; } } }