Question

So, here is my issue, im working in a Wpf application, so i dont have all of the standard windows form controls.. so im attempting to use a windowsformshost, to hold a webbrowser inside of a tabitem. So here is what i have:

        Tab t = new Tab();
        Browser newbrowse = new Browser(t);
        WindowsFormsHost host = new WindowsFormsHost();
        Grid g = new Grid();

        host.Child = newbrowse;
        newbrowse.Dock = DockStyle.Fill;
        g.Children.Add(host);

        t.Header = "New Tab";
        t.Content = g;
        tabControl1.Items.Add(t);

now, Tab, and Browser, are just my custom implementations of the controls, and they both are tested and working. So that is not the issue. Now as far as i can see, that code should work. But I'm left staring at a blank tab page. Note that this will need to be in the codebehind and cant be included in the WPF itself.

Thanks for any input! :) Cheers

EDIT: Note that i have also tried the operation with the standard, controls.tabitem, and forms.webbrowser to the same effect

Was it helpful?

Solution

I just tried this, and apparently what breaks your plan is the line:

newbrowse.Dock = DockStyle.Fill;

Comment it out, and watch how it suddenly works!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top