简体   繁体   English

CefSharp浏览器未在WPF中加载

[英]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 . 我通过Nu-get软件包管理器安装了Cef,并按照这里所说的逐步配置了我的项目。 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. 我添加了HorizontalAlignment和verticalAlignment,以防它出现但太小而看不到,但无济于事。 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 . 而不是Load

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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