如何在Windows 10商店应用程序中打开多个窗口

时间:2016-02-10 00:14:48

标签: c# xaml windows-store-apps multi-window

我注意到Microsoft Edge能够打开多个窗口,但我无法在任何地方找到任何打开多个窗口的示例。

我需要在我的应用程序中打开多个窗口,从我的主窗口WebView弹出窗口,我知道这是可能的,但我不知道从哪里开始,也没有任何在互联网上

enter image description here

1 个答案:

答案 0 :(得分:2)

您可以尝试以下示例代码

var currentAV = ApplicationView.GetForCurrentView();
var newAV = CoreApplication.CreateNewView();
await newAV.Dispatcher.RunAsync(
            CoreDispatcherPriority.Normal,
            async () =>
            {
                var newWindow = Window.Current;
                var newAppView = ApplicationView.GetForCurrentView();
                newAppView.Title = "New window";

                var frame = new Frame();
                frame.Navigate(typeof(MainPage), null);
                newWindow.Content = frame;
                newWindow.Activate();

                await ApplicationViewSwitcher.TryShowAsStandaloneAsync(
                    newAppView.Id,
                    ViewSizePreference.UseMinimum,
                    currentAV.Id,
                    ViewSizePreference.UseMinimum);
            });

来源:https://social.msdn.microsoft.com/Forums/sqlserver/en-US/f1328991-b5e5-48e1-b4ff-536a0013ef9f/uwpis-it-possible-to-open-a-new-window-in-uwp-apps?forum=wpdevelop