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.