WIN10 UWP Set Startup Window size Get window size

Source: Internet
Author: User

This article mainly says how to set the starting size of our window, UWP the Startup window size. setting up the startup Window

To set the window size

Applicationview.preferredlaunchviewsize = new Size (1000, 1000);

            Applicationview.preferredlaunchwindowingmode = applicationviewwindowingmode.preferredlaunchviewsize;

Applicationview.preferredlaunchwindowingmode Set UWP window full screen

If you set the screen size to make each open window smaller, you can use it simply (the following code has no tests)

Applicationview.preferredlaunchwindowingmode = applicationviewwindowingmode.preferredlaunchviewsize;

Applicationview.preferredlaunchwindowingmode =

Applicationviewwindowingmode.auto;

Similar to this problem, UWP's title bar problem, we set the Extendviewintotitlebar=true, led to the absence of a title bar, but if we set false after the program is closed after the discovery is not used, the simple way

            var windows = Coreapplication.getcurrentview (). TitleBar;

            Windows. Extendviewintotitlebar = false;

            Windows. Extendviewintotitlebar = true;
Applicationview.preferredlaunchwindowingmode = Applicationviewwindowingmode.fullscreen;

Settings found that our window has not become smaller, in fact, using the following code

Window minimum

Applicationview.getforcurrentview (). Setpreferredminsize (New Size (200, 100));
Get window Size

Window.Current.Bounds.Width

Get window Height

Window.Current.Bounds.Height

But if we need to judge the size of our windows, a simple way to use dynamic adaptation

       <visualstatemanager.visualstategroups > <visualstategroup currentstatechanged= "{x:Bind View.

                        Narrowvisual} "> <VisualState> <VisualState.StateTriggers>

                    <adaptivetrigger minwindowwidth= "720"/> </VisualState.StateTriggers> <visualstate.setters > <!--<setter target= "img.visibility value=" Coll

                apsed "></Setter>--> </VisualState.Setters> </VisualState> <VisualState> <VisualState.StateTriggers> <ada Ptivetrigger minwindowheight= > </AdaptiveTrigger> </visuals Tate.

                Statetriggers> <visualstate.setters > </VisualState.Setters> </vIsualstate> </VisualStateGroup> </VisualStateManager.VisualStateGroups>
 

Binding changes in the background, I write in view Narrows.

And then in view write we get the window size

        public void Narrowvisual (object sender, Visualstatechangedeventargs e)

        {

            //window.current.bounds.width

            Window.Current.Bounds.Height

        }


This work is licensed with the knowledge sharing signature-non-commercial use-sharing 4.0 International license agreement in the same way. Welcome to reprint, use, republish, but be sure to keep the article signed Lindesi (including Links: HTTP://BLOG.CSDN.NET/LINDEXI_GD), not for commercial purposes, based on the modified work of this article must be issued with the same license. If you have any questions, please contact me.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.