Add by code

Jul 8, 2008 at 10:48 AM
Hi!

I'm trying to add DockingManager and all content by code, but I have no success.. I used your code on "LoadNewDockableContent" that I found in another thread.
I get error that "'System.Windows.Controls.UIElementCollection' not can be null"

ContentControl

 

_ContentControl = new ContentControl();

 

 

DockingManager _DockingManager = new DockingManager();

 

 

_ContentControl.Content = _DockingManager;

 

 

//mainGrid is a grid on the WPF window
mainGrid
.Children.Add(_ContentControl); 

 

 

MyUserControl _MyUserControl = new MyUserControl();

 

 

LoadNewDockableContent(_DockingManager, _MyUserControl , "MyUC1", "UC1", "", Brushes.WhiteSmoke, AnchorStyle.Left, false);

 

Jul 9, 2008 at 8:07 AM
Which thread are you referring? can you post the complete code?
Jul 9, 2008 at 10:27 AM
Edited Jul 9, 2008 at 10:29 AM


adospace wrote:
Which thread are you referring? can you post the complete code?


I'm so sorry.  The "LoadNewDockableContent" I refer to is last post in this thread: http://www.codeplex.com/AvalonDock/Thread/View.aspx?ThreadId=28985

What I need is simply some help or codeexample on how to add my UseControls to a "DockingManager" (wich I userstand is the main component for docking) and all other needed docking controls.

Jul 9, 2008 at 2:43 PM

No problem, try we code like this:

DockingManager _DockingManager = new DockingManager(); 
mainGrid.Children.Add(_DockingManager );  

MyUserControl _MyUserControl = new MyUserControl();

LoadNewDockableContent(_DockingManager, _MyUserControl , "MyUC1", "UC1", "", Brushes.WhiteSmoke, AnchorStyle.Left, false);