I do know how to open additional windows using TryShowAsStandaloneAsync
. However, if the original window is closed - TryShowAsStandaloneAsync
fails (Wh
Answering why TryShowAsStandaloneAsync
fails once you have closed the main window:
I think TryShowAsStandaloneAsync
tries to use the main view as the anchor view (ie, a window to place the new window relative to).
Once you close the main window TryShowAsStandaloneAsync
fails because it has no anchor view.
The workaround is to specify an anchorViewId
of a view that is open (one of the new windows you opened prior to closing the main window), via an overload of TryShowAsStandaloneAsync:
await ApplicationViewSwitcher.TryShowAsStandaloneAsync(
viewIdToShow, // Id of a new view, or of your hidden main view
ViewSizePreference.Default,
anchorViewId, // Id of one of your visible windows
ViewSizePreference.Default);
From this answer.