uwp-experiences icon indicating copy to clipboard operation
uwp-experiences copied to clipboard

First time after the app launch, it is opening in a default size other than the size set.

Open rahulkps23 opened this issue 4 years ago • 0 comments

When you run the UWP app on a PC for the first time, the app will open in size(other than the height and width we set) other than the size we set. From second time when we open the app in that PC there is no issue, it will open in the size which we set. Issue is present only during first time open of the app on that particular PC.

  • To reproduce this issue on the same PC we need to unistall and install the app and open the app. So that it behaves as if it is installed freshly on this PC and it opens in a size it wish(may be some default size values it taking when opened for first time).

  • Our team tried to fix this by searching the place to put the default height and width values, but we didn't find any way. Is there any other way or is this a bug?

  • The temporary solution we made is we are resizing the screen to the required size(height and width) values if the app is open for the first time on that PC. eg: we need to write this code in onnavigated to and onlaunched methods of app,xaml.cs:

`Size size = new Size(width, height);

ApplicationView.GetForCurrentView().SetPreferredMinSize(size); ApplicationView.PreferredLaunchViewSize = size; ApplicationView.PreferredLaunchWindowingMode=ApplicationViewWindowingMode.PreferredLaunchViewSize;`

rahulkps23 avatar Apr 27 '20 08:04 rahulkps23