CefWebbrowser isnt fitting to the WindowsFormHost controller

Having problems with building or using the CefGlue .NET/Mono binding? Ask your questions here.

Moderator: fddima

CefWebbrowser isnt fitting to the WindowsFormHost controller

Postby robind336 » Tue Sep 09, 2014 4:17 am

Hi,

In my project I have integrated MDI and CEF. I am basically trying to open Cef browser in MDI child windows.
I have currently hosted my CefWebbrowser in WindowsFormHost Controller.
The problem I am facing is the Cef browser isnt fitting to the window. It shows inside my child window which has the WindowsFormHost Controller. But if i bring another window, the web pages overlap.
In a nutshell, my problem is that the Cef browser is opening inside my window(showing scroll bars etc also). But its not fitted into the window, bringing any other window on it starts overlapping the content.
I am not sure if its a problem from CEF settings side or from WindowsFormHost.
This is my piece of code.

CefWebBrowserControl.xaml
Code: Select all
<UserControl x:Class="UI.View.CefWebBrowserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <WindowsFormsHost Name="BrowserHost"></WindowsFormsHost>
    </Grid>
</UserControl>

CefWebBrowserControl.xaml.cs
Code: Select all
InitializeComponent();
var browserCtl = new CefWebBrowser();
browserCtl.StartUrl = "http:\\www.google.com";
browserCtl.Dock = System.Windows.Forms.DockStyle.Fill;
browserCtl.BringToFront();
BrowserHost.Child = browserCtl;


kindly help
robind336
Techie
 
Posts: 17
Joined: Mon Sep 01, 2014 9:38 am

Re: CefWebbrowser isnt fitting to the WindowsFormHost contro

Postby oxbow » Sat Oct 25, 2014 4:54 pm

I am hosting the CEF control in a WindowsFormHost. I add the WindowsFormHost to the UserControl in the C#, not the XAML. No issues when the UserControl is nested directly in a Window object. But I realize when I contain the UserControl in a WPF tab using dependency injection, the control has scroll bars. I have not looked into this as it is a lower priority item for me right now. I also add the UserControl to the Window in the C# code instead of the XAML because I need to pass an argument to the constructor.
oxbow
Newbie
 
Posts: 8
Joined: Fri Oct 17, 2014 12:20 am

Re: CefWebbrowser isnt fitting to the WindowsFormHost contro

Postby oxbow » Sat Nov 08, 2014 12:24 am

Update to last comment. No problems in tab either. Scroll bars appeared because google web page does not squeeze and change layout for very small view port.
oxbow
Newbie
 
Posts: 8
Joined: Fri Oct 17, 2014 12:20 am


Return to CefGlue Forum

Who is online

Users browsing this forum: No registered users and 16 guests