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.
UWP Multiple views in single UI Thread
Asked Answered
Currently, there is no relevant documentation explaining this feature. –
Clerestory
Still nothing? :( –
Eddieeddina
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();
© 2022 - 2024 — McMap. All rights reserved.