How can I position the window's position on startup to the right side of the user's screen?

后端 未结 6 996
逝去的感伤
逝去的感伤 2021-02-19 11:17

I am currently creating a sidebar-like WPF application in C#. When a user starts the application, I would like the window to automatically position it\'s self to the side of the

6条回答
  •  有刺的猬
    2021-02-19 11:45

    public MainWindow()
    {
        InitializeComponent();
        WindowStartupLocation = WindowStartupLocation.Manual;
        Left =  System.Windows.Forms.SystemInformation.PrimaryMonitorSize.Width - Width;
    }
    

提交回复
热议问题