简体   繁体   中英

Tabbed Browser CefSharp

I have successfully added a WebView to windows in WPF. How can I add tabs to the browser? I have googled but have not found any good documentation for making a tabbed browser in CefSharp.

var settings = new CefSharp.Settings
{
     PackLoadingDisabled = true, UserAgent="MosleM 7026"
};
if (CEF.Initialize(settings))
{
    WebView view = new WebView();
    view.Address = "http://www.google.com";
    BrowserHost.Children.Add(view);
}    

xaml :

<Grid x:Name="BrowserHost" RenderTransformOrigin="0.5,0.5">
     <Grid.RenderTransform>
</Grid.RenderTransform>

You need to add a <TabControl> with one WebView on each TabItem . I'm not sure how well it will work, but this would be the general theory of operation. Have you tried?

I think cefSharp does not have that functionality. As Per Lundberg said, you have to add this manually. Try to add a tabcontrol and add new webcrontrols to the tabpages.

You will have issues with this line:

if (CEF.Initialize(settings))

since the initialize can only be called once by app domain. Try to use this

if (Cef.IsInitialized == false)
            Cef.Initialize(settings);

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