How to create a new window in UWP
---date: Feb 07, 2016
tags:
- C#
- UWP
language: English
---
This post is more than 10 years old. If this is a technical post, the post will most likely not working, but feel free to try it and see if it works.
Some friends of mine asked me how to create a window in UWP just like WinForms or UWP, to make their app more desktop-like. Actually, it is pretty simple.

I cannot say this is difficult or simple. In order to open a new window, You need to use CoreApplication.CreateNewView() to generate the Window, or view:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | var currentAV = ApplicationView.GetForCurrentView(); await newAV.Dispatcher.RunAsync( CoreDispatcherPriority.Normal, async () => { var newWindow = Window.Current; var newAppView = ApplicationView.GetForCurrentView();newAppView.Title = title; //The title of new windowvar frame = new Frame(); frame.Navigate(typeof(Page), Datatosend); //Navigation is here newWindow.Content = frame; newWindow.Activate();await ApplicationViewSwitcher.TryShowAsStandaloneAsync( newAppView.Id, ViewSizePreference.UseMinimum, currentAV.Id, ViewSizePreference.UseMinimum); }); |
