This should help
https://github.com/microsoft/WPF-Samples/blob/master/PerMonitorDPI/readme.md
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have developed a countdown app to display a timer on a comfort monitor, full screen, for speakers at conferences. Normally, the resolution of the work laptop screen running the program and second monitor have resolutions 1920 x 1080, the app works fine. However, when I use my personal laptop with screen at 3840 x 2160 resolution I cannot get the counter to display on the second monitor, it opens always on the laptop, main monitor. The code I have used:
Screen secondaryScreen = Screen.AllScreens[1];
rightWin = new ExtendedDisplay()
{
WindowStartupLocation = WindowStartupLocation.Manual,
WindowState = System.Windows.WindowState.Normal,
Left = secondaryScreen.WorkingArea.Left,
Top = secondaryScreen.WorkingArea.Top,
Width = secondaryScreen.WorkingArea.Width,
Height = secondaryScreen.WorkingArea.Height
};
rightWin.DataContext = vm;
rightWin.Show();
rightWin.WindowState = WindowState.Maximized;
rightWin.Owner = this;
I see that by changing the DPI on my laptop from 250% to 100% or 125% the App works correctly, the counter displays on the extended monitor. From 150% upwards, I am back to having the counter showing on my laptop screen. I am not sure how to manage this. In the future, I will want to add a third monitor so I need to understand what is happening. Thanks