1

I'm trying to enable the WebView control to appear properly on high DPI display. Following the instruction from here:

https://learn.microsoft.com/en-us/windows/communitytoolkit/controls/wpf-winforms/webview#high-dpi

While I can't find where is the correct application configuration file to add the below code:

<application xmlns="urn:schemas-microsoft-com:asm.v3">
   <windowsSettings>
     <!-- The combination of below two tags have the following effect :
     1) Per-Monitor for >= Windows 10 Anniversary Update
     2) System < Windows 10 Anniversary Update -->
     <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitor</dpiAwareness>
     <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
   </windowsSettings>
 </application> 

Right now I have a file named App.config, but I can't add the above code into it successfully. So where is that file?

Pavel Anikhouski
  • 21,776
  • 12
  • 51
  • 66
Jeremy Parker
  • 408
  • 2
  • 4
  • 19

1 Answers1

1

You should place these settings in application manifest file (app.manifest) instead of app.config, this github repo with samples contains step-by-step tutorial. This thread also contains some samples

Pavel Anikhouski
  • 21,776
  • 12
  • 51
  • 66
  • But the [MSDN article](https://learn.microsoft.com/en-us/windows/communitytoolkit/controls/wpf-winforms/webview#high-dpi) asks for entering that info in the `app.congfig` file. Is that incorrect info? – nam May 10 '20 at 16:25
  • @nam [Github](https://github.com/Microsoft/WPF-Samples/tree/master/PerMonitorDPI#enabling-per-monitor-dpi-for-your-app) sample tells about `app.manifest`, the same is mentioned in this [msdn article](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/mt846517(v%3Dvs.85)) – Pavel Anikhouski May 10 '20 at 16:30