MainWindow window = new MainWindow();
window.Activate();
This is the function provided by Microsoft to open a new window. doc link
But using Activate() is not the effect I want, it is hidden behind the parent window, and it seems that there is no interface to adjust the size and position of the widnow.
I tried my best, but I still can't find a way.Below are some attempts.
LgnRegWindow lgnRegWin = new LgnRegWindow();
IntPtr hWnd = WinRT.Interop.WindowNative.GetWindowHandle(lgnRegWin);
WindowId myWndId = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(hWnd);
AppWindow appWindow = AppWindow.GetFromWindowId(myWndId);
OverlappedPresenter _presenter = appWindow.Presenter as OverlappedPresenter;
appWindow.Resize(new SizeInt32(600, 800));
_presenter.IsResizable = false;
appWindow.Show();
This cannot be done like ShowDialog().