locked
Set window size of UWP application RRS feed

  • Question

  • User292172 posted

    I am writing a cross-platform (iOS, Android, UWP) application using PCL and Xamarin.Forms.

    I use the UWP app for general testing since it is easier (don't need an emulator).

    Is there a way to change the default window size of the UWP? I'd like it more "phone" shaped. It will help with estimating the layout (realizing I still may need to tweak on each platform).

    Wednesday, May 3, 2017 3:29 PM

Answers

  • User331440 posted

    I don't know if you found your answer yet but to set a start size of your UWP-project just go to your App.Xaml.cs or MainPage.Xaml.cs in your UWP project and do something like this:

    Xamarin.Forms.Forms.Init(e, assembliesToInclude); ApplicationView.PreferredLaunchViewSize = new Size(400, 600); ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

    And play around with the width and height until you have something that looks like a phone :)

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, June 22, 2017 8:49 AM

All replies

  • User331440 posted

    I don't know if you found your answer yet but to set a start size of your UWP-project just go to your App.Xaml.cs or MainPage.Xaml.cs in your UWP project and do something like this:

    Xamarin.Forms.Forms.Init(e, assembliesToInclude); ApplicationView.PreferredLaunchViewSize = new Size(400, 600); ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

    And play around with the width and height until you have something that looks like a phone :)

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, June 22, 2017 8:49 AM
  • User392795 posted

    Hi @Tobnil , is there any way of having this screen size as the fixed size?

    Wednesday, April 15, 2020 12:24 PM
  • User393244 posted

    @Tobnil, thanks! That worked.

    Saturday, May 2, 2020 11:30 AM