How to open a “new window” in a Windows 10 Universal App

I had to dig a little bit to find this. Since not all form factors support multiple windows and tablet mode generally discourages floating windows this is probably buried for a reason, but I wanted to do it anyway so here it is:

var viewId = 0;

var newView = CoreApplication.CreateNewView(); await newView.Dispatcher.RunAsync( CoreDispatcherPriority.Normal, () => { var frame = new Frame(); frame.Navigate(typeof(YourViewPageType), ViewModelDataOrNull); Window.Current.Content = frame; viewId = ApplicationView.GetForCurrentView().Id; ApplicationView.GetForCurrentView().Consolidated += App.ViewConsolidated; Window.Current.Activate(); }); var viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(viewId);

Hopefully that will save someone some digging. Smile

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pin It on Pinterest

Share This