The name ChromiumWebBrowser does not exist in the namespace “clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf”

后端 未结 5 796
难免孤独
难免孤独 2021-01-12 07:20

I had followed this link to implement CefSharp applicaton.

But I have stuck while coding MainWindow.xaml.

Blend for VS 2015 said,

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-12 07:46

    its not supported in the XAML desginer, so load it in run time:

    1. Remove the element from the XAMl, and instead place any container such as a Border:

      
      
    2. in the Constructor code, after InitializeComponent(); call, craete the browser element and place into the container. even better to declare the browser in the class scoop:

      CefSharp.Wpf.ChromiumWebBrowser browser = new CefSharp.Wpf.ChromiumWebBrowser();
      
      public MainWindow()
      {
          InitializeComponent();
          cefChromeContainer.Content = browser;
          browser.Address = "https://stackoverflow.com";
      }
      

提交回复
热议问题