dockablecontent question

Nov 24, 2009 at 7:18 AM

I would like to create WPF project using AvalonDock. I have one important question.

How Can I set content of the dockablecontent to WPF window. It give exception .

I found way to do this (shown below), 

 

                            MainOrganizationsList win = new MainOrganizationsList();
                            gr = (Grid)win.Content;
                            win.Content = null;
                            dockcon.Content = gr;
                            
                            dockcon.Name = (string)btnSender.Content.ToString().Replace(" ", "");
                            win.Close();
                            documentsHost.Items.Add(dockcon);

 

    			DockableContent dockcon = new DockableContent();
                	dockcon.Title = "Title";
                	Grid gr = new Grid();	          



                            MainOrganizationsList win = new MainOrganizationsList();

                            gr = (Grid)win.Content;

                            win.Content = null;

                            dockcon.Content = gr;

                            

                            dockcon.Name = "MainOrg";

                            win.Close();

                            documentsHost.Items.Add(dockcon);

but this is not good idea, because really I don't run window. I just take his content. For example I cant use window Loaded handler in this case.