Currently in UWP apps multiple windows for an app are running in different UI threads, which makes development difficult (to run in the current dispatcher), In MSBuild 18 microsoft announced that now mutliple windows for the same app will run in the single UI thread. Is this feature available for when it can be expected. Because for handling new window is becoming a big pain in UWP apps.
Your prayers have been answered... All the pain with multiple secondary views on different UI threads is gone.
There is new AppWindow class. It is still in preview (with some limitations), but works with 1903 (build 18362).
AppWindow appWindow = await AppWindow.TryCreateAsync();
Frame appWindowContentFrame = new Frame();
appWindowContentFrame.Navigate(typeof(SecondPage));
ElementCompositionPreview.SetAppWindowContent(appWindow, appWindowContentFrame);
await appWindow.TryShowAsync();
More info from Microsoft
Older demo app
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With