How can I set the Windows position on startup

2020-03-20 06:44发布

问题:

I want to set the position of the window on the right side on the screen similar to WPF. Is there a way in UWP to do this?

回答1:

AFAIK it's not possible in UWP (at least not yet), you can change window size or make it fullscreen by accessing ApplicationView class, but there are no such methods/properties like in WPF.

There was also similar question on MSDN.



回答2:

Yes there is a way :) Go to your xaml for example Windows1.xaml

then put this there. Example code

 <Window
x:Class="Poultry_Management_System.Window1"      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Login"
Width="450"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
ResizeMode="NoResize"
Topmost="True"
KeyDown="keyDown_form"
Height="200">

As you can see my StartupLocation there is in the Center.