How can we Reduce the Width and Height of UWP app? & How can we set position to bottom left of screen?

Viral Rathod 0 Reputation points
2024-08-15T16:52:28.0433333+00:00

I want to reduce the Width & Height of UWP app.

Also want to set the position of app to the bottom left of the screen.

I have added below code in App.xaml.cs inside OnLaunched(LaunchActivatedEventArgs args)

        var view = ApplicationView.GetForCurrentView();

        view.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);

        view.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);

        view.SetPreferredMinSize(new Size(10, 10)); // Set your preferred minimum size

        view.TryResizeView(new Size(10, 10)); // Set the initial size to a small value

    

       //It resizes if I uncomment below two lines: But I want to resize it to 10,10 instead of 192,48

        //view.SetPreferredMinSize(new Size(192, 48)); // Set your preferred minimum size

        //view.TryResizeView(new Size(192, 48)); // Set the initial size to a small value

        rootFrame.Width = 1;

        rootFrame.Height = 1;

        rootFrame.MaxHeight = 1;

        rootFrame.MaxWidth = 1;
Universal Windows Platform (UWP)
{count} votes

1 answer

Sort by: Most helpful
  1. Junjie Zhu - MSFT 18,486 Reputation points Microsoft Vendor
    2024-08-16T06:34:33.47+00:00

    Hi @Viral Rathod ,

    Welcome to Microsoft Q&A!

    How can we Reduce the Width and Height of UWP app?

    According to the document, "The smallest allowed minimum size is 192 x 48 effective pixels. The largest allowed minimum size is 500 x 500 effective pixels. If you set a value outside of these bounds, it is coerced to be within the allowed bounds. "

    So, Size(10,10) is not achievable.

    How can we set position to bottom left of screen?

    UWP doesn't have the API that could change its position, the position of the UWP window can't be controlled from the app level.

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.