CefSharp ChromiumWebBrowser未显示该页面

时间:2014-10-23 13:37:47

标签: wpf chromium-embedded cefsharp

我尝试以编程方式将ChromiumWebBrowser控件添加到我正在开发的应用程序中。这些是我跟随的步骤:

CefSettings settings = new CefSettings()
{
    PackLoadingDisabled = true,
};

Cef.Initialize(settings);

_webControl = new ChromiumWebBrowser()
{
    Width = this.ElementWidth,
    Height = this.ElementHeight
};

_webControl.Loaded += (sender, e) =>
{
    _webControl.Address = "http://www.google.com";
};

grid.Children.Add(_webControl);

但我无法显示任何内容。我错过了什么吗?

1 个答案:

答案 0 :(得分:1)

问题在于我在做什么

grid.Children.Add(_webControl);

InitializeComponent();

交换订单使代码有效。