In the following code I can not tinker with the ViewSizePreference options and get the child to be smaller than the parent. I am making a popup from a page. That part works fine. However, both windows are the exact same size.
private async void Test_Click(object sender,RoutedEventArgs e){
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);
});
}
Yes, I just found the same issue, and I've reported this issue. As soon as I get the response of this issue, I will post here.
By now, we can use a workaround to solve this problem, since your want to expand a new window with a smaller size than the main window, you can use ApplicationView.TryResizeView | tryResizeView method to set the size of new window programmatically.
For example:
Then in the
OnNavigatedTo
method andLoaded event
:Or if you don't mind to see the resizing process of the new window, you can also try this code, and there is no need to send size as parameter to the new window in this method: