Transform Screen.PrimaryScreen.WorkingArea to WPF dimensions at higher DPI settings Transform Screen.PrimaryScreen.WorkingArea to WPF dimensions at higher DPI settings wpf wpf

Transform Screen.PrimaryScreen.WorkingArea to WPF dimensions at higher DPI settings


You get the transformed work area size from the SystemParameters.WorkArea property:

Top = 0;Left = 0;Width = System.Windows.SystemParameters.WorkArea.Width;Height = System.Windows.SystemParameters.WorkArea.Height;


In WPF, you can use the SystemParameters.PrimaryScreenWidth and SystemParameters.PrimaryScreenHeight properties to find out the primary screen dimensions:

double width = SystemParameters.PrimaryScreenWidth;double height = SystemParameters.PrimaryScreenHeight;


If you wanna get the dimensions of both Screens you simply can use:

var primaryScreen =    System.Windows.Forms      .Screen      .AllScreens      .Where(s => s.Primary)      .FirstOrDefault();var secondaryScreen =    System.Windows.Forms      .Screen      .AllScreens      .Where(s => !s.Primary)      .FirstOrDefault();

After this you can reach Width, Height etc. by using

primaryScreen.Bounds.Width

So Long ;)