I have a WPF .Net 4.7 application with per monitor DPI Aware. I enable the DPI awareness following the solution explained here.
I want to open a dialog at the top left corner of my mainWindow, and I do the following:
var window = new Window();
window.Owner = mainWindow;
window.WindowStartupLocation = WindowStartupLocation.Manual;
window.Left = mainWindow.Left;
window.Top = mainWindow.Top;
window.Show();
I have 2 monitors with different DPI scale.
If I run the application from Visual Studio, it all works fine: regardless of which monitor the mainWindow is, the dialog is always positioned at the top-left corner of the mainWindow.
But if I run the application from Windows Explorer, the dialog is positioned correctly only on the monitor in which the Windows Explorer was when I launched the application.
Why this different behaviour, and how can I correctly position the dialog when I run the application from Windows Explorer?