How to set WPF window size to 25 percent of relative monitor screen

I have a WPF window and how do I set the WPF window size to 25 percent of the relative monitor screen. How can I set these properties.

+3


source to share


1 answer


In the constructor MainWindow add

this.Height = (System.Windows.SystemParameters.PrimaryScreenHeight * 0.25);
this.Width = (System.Windows.SystemParameters.PrimaryScreenWidth * 0.25);

      



Also, don't set WindowState = "Maximized" in your MainWindows.xaml, otherwise it won't work. Hope this helps.

+18


source







All Articles