[WPF] 초기 화면 위치 설정
1. Reference
https://stackoverflow.com/questions/4019831/how-do-you-center-your-main-window-in-wpf
https://stackoverflow.com/questions/1545258/changing-the-start-up-location-of-a-wpf-window
2. SourceCode
A. Move to Center
private void CenterWindowOnScreen()
{
double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth;
double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight;
double windowWidth = this.Width;
double windowHeight = this.Height;
this.Left = (screenWidth / 2) - (windowWidth / 2);
this.Top = (screenHeight / 2) - (windowHeight / 2);
}
B. Set position
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1"
Height="500" Width="500"
WindowStartupLocation="Manual"
Left="0" Top="0">
</Window>