简体   繁体   中英

CefSharp browser doesn't load up in WPF

I installed Cef via Nu-get package manager and configured my project step by step like it was said here . The app starts, all seems fine, but when I actually try to open up a page, it shows a moment of loading, then eventually does nothing. The code I used was this:

var targetGrid = (parent as BrowseWares).ViewerGrid;
CefSettings settings = new CefSettings();
settings.CefCommandLineArgs.Add("enable-gpu", "1");
settings.CefCommandLineArgs.Add("enable-webgl", "1");
Cef.Initialize(settings);
var chromeBrowser = new ChromiumWebBrowser();
chromeBrowser.HorizontalAlignment = HorizontalAlignment.Stretch;
chromeBrowser.VerticalAlignment = VerticalAlignment.Stretch;
chromeBrowser.Load("https://get.webgl.org/");
targetGrid.Children.Add(chromeBrowser);

Let me add that yes the button works, was tested before. I added the HorizontalAlignment and the vertical one in case it would show up but too small to be visible, but to no avail. Could someone show me how to make this work? No errors, no exceptions, it just doesn't show up.

All I needed was

chromeBrowser.Address = "http://get.webgl.org/";

instead of the Load .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM