Search code examples
uwpsize

How do I make uwp app size smaller it should be simple


I am trying to make a very simple UWP app smaller than default but i can't. How to do this? As you can see in the image the windows calculator app and the notepad is smaller in width than my app. I can't make it smaller???

enter image description here

I have looked on google and this site but can't find any answers. It should be simple??? If this has been answered please guide me to the answer. Thanks


Solution

  • You could use the ApplicationView.PreferredLaunchViewSize Property to set the size of your UWP APP.

    1. Set a minimum value for the size using ApplicationView.SetPreferredMinSize(Size) Method.
    2. Set a value for the size of the app as you want by setting the ApplicationView.PreferredLaunchViewSize Property
    3. Apply the size by setting ApplicationView.PreferredLaunchWindowingMode Property.

    Please refer to the following code:

            public MainPage()
        {
            this.InitializeComponent();
    
            //set minimized size
            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(200, 200));
            // change to smaller size
            ApplicationView.PreferredLaunchViewSize = new Size(400, 400);
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
        }