'TryResizeView doesn`t work and always return false

I am create few ApplicationView and save them id's to List<int>. When I try resize views TryResizeView() return false, sometimes its resize main window.

foreach (var id in ids)
{
    await ApplicationViewSwitcher.SwitchAsync(id);
    bool res = ApplicationView.GetForCurrentView().TryResizeView(new Size(700, 700));
}

When I am create windows I set minimum size 300.



Solution 1:[1]

TryResizeView doesn`t work and always return false

I'm afraid you can't call resize method to resize SecondaryPage from main window. You should call it in the SecondaryPage page. and then GetForCurrentView will retrieve correct ApplicationView instance.

If you do want to show custom size window, the better way is show multiple views with AppWindow, and it has RequestSize method that could initialize specific window size you want.

colorPickerAppWindow.RequestSize(new Size(300, 428));

And here is official code sample that you could refer to.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nico Zhu - MSFT