Adding a browser to System.Window in C#

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

Adding a browser to System.Window in C#

Postby dakipmyster » Fri Jan 04, 2019 5:44 pm

I've been reading up on how to implement CEF with Winforms and have been able to reproduce inplementing it on my own using Forms. What I need to do though is instead of using the From class and setting its content to the CEF browser, I want to use System.Window and have it load the CEF browser. It seems like getting it to show in the same manner does not work for me

Example of it working

CefSharp.WinForms.ChromiumWebBrowser cBrowser = new CefSharp.WinForms.ChromiumWebBrowser("https://www.google.com");
Form form = new Form();
form.Controls.Add(cBrowser);
form.Show();

What I want to do is this

System.Window window = new System.Window();
CefSharp.WinForms.ChromiumWebBrowser cBrowser = new CefSharp.WinForms.ChromiumWebBrowser("https://www.google.com");
window.Content = cBrowser;
window.Show();

But using the Window class does not show the browser at all. Any ideas as to why?
dakipmyster
Newbie
 
Posts: 1
Joined: Fri Jan 04, 2019 5:38 pm

Re: Adding a browser to System.Window in C#

Postby amaitland » Sat Jan 05, 2019 7:00 am

You should ask this sort of question on stack overflow.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 17 guests