I'm trying to convert IE web browser window into a CefSharp (v 96.0.180) window into as a part of a larger WPF application. The application itself follows the system dpi level (resizes UI with it), but the IE window kept 100% dpi no matter what was the system setting. When I converted the control to CefSharp, it would start to follow the system dpi. The problem is that the page is rendered zoomed in and ugly on any dpi over 100%.
To check the Cefsharp window behavior I've tried setting dpi awareness to true or per monitor using app manifest, but it didn't work (and also I'm concerned that it would set it for the whole application, while I only need it for one window/project).
Is there any way to achieve it?
EDIT: code per request: BrowserView.xaml:
<Grid>
<ContentControl Name="wBrowser" RenderOptions.BitMapScalingMode="HighQuality" />
</Grid>
BrowserView.xaml.cs:
public BrowserView()
{
CefRuntime.SubscribeAnyCpuAssemblyResolver();
Cef.EnableHighDPISupport();
LoadApp();
InitializeComponent();
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void LoadApp()
{
var settings = new CefSettings()
{
CachePath = _cachePath,
LogSeverity = LogSeverity.Disable
};
//settings.CefCommandLineArgs.Add("high-dpi-support", "1");
//settings.CefCommandLineArgs.Add("force-device-scale-factor", "1");
settings.CefCommandLineArgs.Add("disable-gpu-compositing");
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
}
(I've also tried to move these calls to App.xaml.cs Main method which I've created as advised in CefSharp wiki/GeneralUsage. Those were the first calls in Main. No effect, whatever I put as commandline args.)
In the same BrowserView.xaml.cs file in an event handler for an event fired when control's been loaded:
var chromiumWebBrowser = new ChromiumWebBrowser();
wBrowser.Content = chromiumWebBrowser;
// call to Window.Show() here
chromiumWebBrowser.LoadUrl(url);
In conclusion, none of the actions above made the window look as it would look if I switched the system settings to DPI 100% and rerun the application (and that look is what I need).