I'm trying to create a new window in my Windows 10 application but I want to be able to specify the initial size for the created window.
So far I'm trying as so, with no luck -
var currentAppView = ApplicationView.GetForCurrentView();
var newCoreAppView = CoreApplication.CreateNewView();
await newCoreAppView.Dispatcher.RunAsync(
CoreDispatcherPriority.Normal,
async () =>
{
var newWindow = Window.Current;
var newAppView = ApplicationView.GetForCurrentView();
newAppView.SetPreferredMinSize(new Size(1, 1));
newAppView.TryResizeView(new Size(300, 300));
newAppView.Title = "New small window";
var frame = new Frame();
frame.Navigate(typeof(NewPage), null);
newWindow.Content = frame;
newWindow.Activate();
await ApplicationViewSwitcher.TryShowAsStandaloneAsync(
newAppView.Id,
ViewSizePreference.UseMinimum,
currentAppView.Id,
ViewSizePreference.UseMinimum);
});