How can I add a child to a DockableContent?

Jun 25, 2009 at 3:50 PM

How can I do that programmatically?

This works:

public sealed class DockableModule : DockableContent
    {
        public DockableModule()
        {
            UserControl uc = new TestModuleUC();
            AddChild(uc);
            Title = "Test Module";
        }
    }

But why can't I do it like that?

 UserControl uc = new TestModuleUC();
 DockableContent dc = new DockableContent();
 dc.Title = module.ModuleName;
 dc.AddChild(uc)

The last statement will not work because DocumentContent does not have any method like that, doesn't it?

Jun 27, 2009 at 10:34 PM

Hi,
It's a content-control with only one "child" so try:

UserControl1 uc = new UserControl1();
DockableContent dc = new DockableContent();
dc.Title = "UserControl";
dc.Content = uc;
_documentsHost.Items.Add(dc);

Best regards,
Juergen

Jul 1, 2009 at 8:28 PM

Thanks Juergen,

that was too easy to see it :-)