tags:

views:

415

answers:

2

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

A: 

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!

Aviad P.
A: 

i have a tab control on window form, and i have to add some images according to current month ( like for january, add a image dn on feb change to next image and so on), kindly tell me how can i add add images and change it dynamically in c sharp,dot net.

thanx.

Anupama