I am creating many ChromiumWebBrowser-Instances programmatically inside my app. On some time later I set the visibility and an address for the browser. Also I wanted to change the zoom-level. But whenever I try to change it in the normal way (like with a simple
browser.ZoomLevel = (Convert.ToDouble(browser.Tag) - 100) / 25.0;
I only get an error :IBrowser instance is null. Browser has likely not finished initializing or is in the process of disposing.
But when I can set the Address, why cant I set the ZoomLevel?
Even if I try to put a method in the FrameLoadEnd
and change the ZoomLevel there, I only get an error, that its on another thread. Shouldn't the event been fired on the same thread? I cannot access the sender of the event inside the event? strange...
Has someone an idea how I can change the ZoomLevel programmatically? I have to change it on load of the site and later by button.
Oh, and btw. I am using the wpf-version of CefSharp 3.
49.0.0
or47.0.4
. TheFrameLoadEnd
event is fired on ` CEF` thread, you'll have to dispatch it onto theUI
thread to access a dependency property. Better to callSetZoomLevel
. RememberCefSharp
isn't some magic black box, the source is there, just make sure you select the correct branch that corresponds to the version your using. – AlterationChromiumWebBrowser
and overrideOnIsBrowserInitializedChanged
github.com/cefsharp/CefSharp/blob/cefsharp/49/CefSharp.Wpf/… – Alteration