Select to view content in your preferred language

WPF Per-monitor DPI awareness / Map goes missing

1723
6
Jump to solution
06-27-2022 09:04 AM
DavidSchuster
Regular Contributor

Hello!

We have a public safety mapping application that was developed in-house using the ArcGIS Runtime for .NET (WPF).

We recently enabled per-monitor DPI awareness to our WPF application and noticed a new issue with the display of the ArcGIS map. When the window is moved between monitors with different DPI scaling, the map will sometimes go missing. Often it won't reappear on its own until you move it to another monitor.

Use of multiple monitors is a common scenario for our emergency operations center, dispatchers, and command staff so we're hoping to find a solution for this.

I've attached a small sample project using the latest version of ArcGIS Runtime .NET WPF to demonstrate the issue. You'll need to add your API key in app.xaml.cs and restore the nuget packages. The per-monitor DPI awareness is controlled in the app.manifest file.

Steps to reproduce

  1. Test this on a Windows machine with multiple monitors.
  2. Make sure to change the Windows display settings on each monitor to use a different DPI scaling (100%, 125%, 150%, etc).
  3. Build and launch the test application.
  4. Move the application window back and forth across monitors repeatedly. 
    Keep doing this and eventually the map will disappear. I put a textbox "Where'd my map go?" underneath the map control in the application to make it more obvious when it goes missing.

Additional Notes

  • Although the map goes missing, it still seems to be processing interactions. For example, try zooming using the mouse scroll wheel over where the map should be, and you'll see the scale bar and layer attribution controls update.
  • Forcing software rendering in the ArcGIS Runtime seems to resolve the issue, however it creates major performance problems for our officers using mobile computers. So that solution will not work for us unfortunately. i.e. AppContext.SetSwitch("Switch.Esri.ArcGISRuntime.ForceSoftwareRendering", true);
  • If all of the monitors have the same DPI scaling set, the problem does not happen.
  • I tried replicating the issue with an older version of the runtime (100.11) and it happens with that version too.
  • Once the problem happens in a session, it seems more likely to happen in that same session.

P.S. We must enable per-monitor DPI awareness on our application to correct two issues:

  • We noticed blurriness in the WPF app and map without per-monitor DPI awareness
  • We use Microsoft's WebView2 control in our WPF app to display web content, and there appears to be a bug in WebView2 that requires per-monitor DPI to be enabled to properly display content in some scenarios.

Thank you in advance for your assistance!

-David

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
dotMorten_esri
Esri Notable Contributor

Just wanted to follow up on this. We've identified the issue and made a fix for the next release (100.15). Unfortunately I wasn't able to come up with a solid workaround for you until that release comes out.

Thank you again for the great and simple reproducer. It helped a lot.

View solution in original post

6 Replies
dotMorten_esri
Esri Notable Contributor

Thank you for the great reproducer. I'm able to reproduce and looking into it.

Btw I wasn't seeing correctly scaling on my PC, and had to change 'PerMonitor' to 'PerMonitorV2' in the app.manifest to get the titlebar etc to also correctly rescale.

0 Kudos
DavidSchuster
Regular Contributor

Thanks Morten, let us know what you find.  Also, thanks for the PerMonitorV2 tip - I wasn't aware of that option!

0 Kudos
dotMorten_esri
Esri Notable Contributor

Just wanted to follow up on this. We've identified the issue and made a fix for the next release (100.15). Unfortunately I wasn't able to come up with a solid workaround for you until that release comes out.

Thank you again for the great and simple reproducer. It helped a lot.

DavidSchuster
Regular Contributor

Thank you sir!

0 Kudos
DavidSchuster
Regular Contributor

Confirmed that this is working now in 100.15 in our application.  Thanks again!

dotMorten_esri
Esri Notable Contributor

Great! Glad it is working for you. Again thank you for making this easy to reproduce.

0 Kudos