Click here to Skip to main content
12,299,131 members (52,187 online)
Click here to Skip to main content
Add your own
alternative version


157 bookmarked

Magic Library Docking Manager Designer

, 16 May 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
Provides docking support without writing one line of code.

Sample Image - DockingManagerExtender.gif


Some days ago as I coded the HelloWorld in C#, there was darkness around me. After crawling through all the articles from CodeProject, there was light. A few days later I got my first version of magic library, from this time my HelloWorld applications looks cool.

Now, much time later, spent millions of hours coding C# in my spare time and on my job, I still use the magic library. With the knowledge gained from using commercial products like Syncfusion Essentiel Tools I felt it's time to write a component for Visual Studio which provides easy access to the great docking features of Magic Library.

Key features

  • You control the docking behavior of your controls in the properties (PropertyGrid).
  • Automatic State Persistence takes care of user customization. The customized layouts are stored in the Isolated Storage.
  • Accessible wrapped DockingManager, all features of future releases of DockingManager are reachable.
  • Needed code is generated by the ©Visual Studio Designer.
  • .NET friendly design with IExtenderProvider.


The component implements the IExtenderProvider interface and wraps a Crownwood.Magic.Docking.DockingManager. The IExtenderProvider extends the controls on your Form with a few of the Crownwood.Magic.Docking.Content properties. At run time the component manages the Content settings for each control and attaches the controls to the wrapped DockingManager.

Using the code

Before you begin, make sure your project has a valid reference to the Magic Library. Go to the Toolbox window, right-click and select Customize Toolbox from the context menu. In the Customize Toolbox dialog, go to the .NET Framework Components tab and select the DockingManagerExtender.dll assembly that you just compiled. Now drop the DockingManagerExtender component to your form.

The component provides the following:

Public Instance Properties

AutomaticStatePersistence Enable or disable the Automatic State Persistence feature. If enabled, the customized docking settings made by the user are persistent by User/Domain/WorkingArea
ContainerControl Gets or sets the object to which the docking manager instance is attached
DockingManager The wrapped Crownwood.Magic.Docking.DockingManager. Direct access to all properties.
InnerControl Sets or gets the Control for which the docking windows will not be allowed to dock inside of the specified control.
OuterControl Sets or gets the Control for which docking windows will not be allowed to dock outside of the specified control.
PlainTabBorder Gets or sets the flag indicating that the appearance is defined as VisualStyle.Plain and this PlainTabBorder property is defined then a full dumped border is drawn around the docking window content.
VisualStyle Gets or sets the VisualStyle which is used to draw content.

Public Instance Methods

LoadConfigFromStream Restores the docking configuration.
ResetAutoPersistent Reset Automatic State Persistence. Changes takes effect after restarting application.
SaveConfigToStream Stores the docking configuration.

Please make sure that the ContainerControl property points to your form, otherwise the component cannot work properly.

Select one of your controls on this form, hit F4 and scroll down to the end in the PropertyGrid. Now you should see new properties like these ones.

After you set ADockingEnable to true, you could change the other properties. This is important, cause if the control is not dock enabled, the other properties are not valid.

If you like to know more about these properties, please refer directly to Magic Docking - VS.NET Style.

ADockingEnable Enables and disables the docking for the control.
CloseButton Enables and disables the close button of the docking window.
DockingStyle Dock style for the control.
FullTitle Text displayed in docking control title.
Icon Icon displayed in tabbed/hide mode.
TabbedMode Indicates if tabbed docking is preferred.
Title Text displayed in tabbed/hide mode.

After enabling docking for your controls, hit F5 to start debugging. If everything went right the controls are docked, finish.

In depth

There are three classes which where used to build this component. For detailed view, please refer to the NDOC generated Help File.


Class Description
DockingContent Wraps Crownwood.Magic.Docking.Content and extends it with needed properties.
DockingManagerConverter DockingManagerConverter provides a TypeConverter for the Crownwood.Magic.Docking.DockingManager
DockingManagerExtender DockingManagerExtender enhances Crownwood.Magic.Docking.DockingManager for design time. It extends the controls on your form with properties, which defines the docking behavior at run time.


  • The order of the controls in the InitializeComponent() method is important for docking order. If you like to dock two controls (A,B) in tabbed mode on the left side, and another (C) not tabbed on the left upper side, please make sure control (C) comes before (A,B), otherwise the docking order is not correct.
  • Every time you change the docking properties with AutomaticStatePersistence, true, you do not see the changes made directly. The DockingManager overrides the changes made with the stored settings. To solve this problem you should not use AutomaticStatePersistence for development.



  • 29.10.2003 - Version 1.1 released which supports UserControl's as ContainerControl
  • 27.05.2003 - bug fixed, generated IsolatedStorage path longer than 260 chars in some cases, updated downloads.
  • 24.05.2003 - experimental release



This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Chris Richner
Software Developer (Senior) Zeit AG
Switzerland Switzerland
My interest is in the future because I am going to spend the rest of my life there. (Charles Kettering)

  • 1996 - 1998 PC Board PPL, HTML, DHTML, Javascript and ASP
  • 1999 - 2001 coding Centura against Sql Database (SqlBase,MSSQL,Oracle)
  • 2002 - 2004 C# Windows Forms
  • 2005 - 2006 C# ASP.NET, Windows Forms
  • 2006 - 2009 C#, WCF, WF, WPF
  • 2010 - 2012 C#, Dynamics CRM, Sharepoint, Silverlight
  • 2013 - 2013 C#, WCF DS (OData), WF, WPF
  • 2014 - now C#, Azure PaaS, Identity, OWIN, OData, Web Api
  • family & friends
  • chilaxing ,)
  • coding

You may also be interested in...

Comments and Discussions

QuestionCan u pls help me Pin
vincezed10-Apr-11 10:34
membervincezed10-Apr-11 10:34 
AnswerRe: Can u pls help me Pin
wsfaso2-Feb-12 4:41
memberwsfaso2-Feb-12 4:41 
GeneralMy vote of 5 Pin
ElBilo1-Apr-11 9:12
memberElBilo1-Apr-11 9:12 
AnswerRe: My vote of 5 Pin
Chris Richner17-Aug-11 21:39
memberChris Richner17-Aug-11 21:39 
QuestionHow to change the dockstate in a content ? Pin
Chen.shaohua23-Aug-09 20:50
memberChen.shaohua23-Aug-09 20:50 
AnswerRe: How to change the dockstate in a content ? Pin
Chris Richner24-Aug-09 22:45
memberChris Richner24-Aug-09 22:45 
GeneralRe: How to change the dockstate in a content ? Pin
Chen.shaohua25-Aug-09 4:36
memberChen.shaohua25-Aug-09 4:36 
GeneralCompatible Version with VS2005 Pin
Challagolla21-Jul-09 23:37
memberChallagolla21-Jul-09 23:37 
GeneralRe: Compatible Version with VS2005 Pin
Chris Richner22-Jul-09 4:33
memberChris Richner22-Jul-09 4:33 
GeneralRe: Compatible Version with VS2005 Pin
Challagolla22-Jul-09 20:05
memberChallagolla22-Jul-09 20:05 
GeneralRe: Compatible Version with VS2005 Pin
Chris Richner3-Aug-09 10:41
memberChris Richner3-Aug-09 10:41 
QuestionHow Free is free? Pin
Findl_Fantastisch26-Jun-07 19:59
memberFindl_Fantastisch26-Jun-07 19:59 
Generalcapture Dock window Hiding and Showing events Pin
Ambili_T17-Apr-07 23:15
memberAmbili_T17-Apr-07 23:15 
GeneralShowing the panels as docked when app starts up. ! Pin
Ambili_T12-Apr-07 1:56
memberAmbili_T12-Apr-07 1:56 
AnswerRe: Showing the panels as docked when app starts up. ! Pin
Chris Richner13-Apr-07 8:31
memberChris Richner13-Apr-07 8:31 
GeneralRe: Showing the panels as docked when app starts up. ! Pin
Ambili_T16-Apr-07 18:41
memberAmbili_T16-Apr-07 18:41 
AnswerRe: Showing the panels as docked when app starts up. ! Pin
Chris Richner17-Apr-07 7:40
memberChris Richner17-Apr-07 7:40 
GeneralRe: Showing the panels as docked when app starts up. ! Pin
Ambili_T17-Apr-07 20:07
memberAmbili_T17-Apr-07 20:07 
GeneralChange location of docked window Pin
Shakeel Mumtaz1-Oct-06 0:04
memberShakeel Mumtaz1-Oct-06 0:04 
Generalgetting event handler for hide button clicked Pin
bhavesh vaghela7-Feb-06 1:08
memberbhavesh vaghela7-Feb-06 1:08 
QuestionOwn Visualstyles Pin
vornst28-Jan-06 13:33
membervornst28-Jan-06 13:33 
GeneralHelp needed: unable to generate DLL Pin
run14921-Nov-05 12:49
memberrun14921-Nov-05 12:49 
GeneralRe: Help needed: unable to generate DLL Pin
deloford5-Jul-06 12:48
memberdeloford5-Jul-06 12:48 
GeneralI was just thinkign of this! Pin
Kevin James26-Oct-05 7:21
memberKevin James26-Oct-05 7:21 
GeneralFree Magic library is still available Pin
motif812-Oct-05 20:12
sussmotif812-Oct-05 20:12 
AnswerBAd link -- Re: Free Magic library is still available Pin
Kevin James26-Oct-05 7:22
memberKevin James26-Oct-05 7:22 
GeneralRe: Free Magic library is still available Pin
badfire4-Dec-05 23:56
memberbadfire4-Dec-05 23:56 
GeneralAutohide Pin
Piovra_26-Jul-05 21:28
memberPiovra_26-Jul-05 21:28 
GeneralNow it is no more for free Pin
Anonymous7-Jun-05 5:57
sussAnonymous7-Jun-05 5:57 
GeneralRe: Now it is no more for free Pin
Jerry Maguire8-Jun-05 6:25
memberJerry Maguire8-Jun-05 6:25 
GeneralRe: Now it is no more for free Pin
kenexcelon5-Sep-05 17:47
memberkenexcelon5-Sep-05 17:47 
Generalhelp: controls do not fit well in dock window Pin
choiceplus25-Oct-04 1:30
memberchoiceplus25-Oct-04 1:30 
GeneralRe: help: controls do not fit well in dock window Pin
Jerry Maguire25-Oct-04 1:52
memberJerry Maguire25-Oct-04 1:52 
GeneralRe: help: controls do not fit well in dock window Pin
choiceplus25-Oct-04 3:15
memberchoiceplus25-Oct-04 3:15 
GeneralRe: help: controls do not fit well in dock window Pin
yoyoba24-Sep-05 4:49
memberyoyoba24-Sep-05 4:49 
I have the same problems, the main-window is minimized after docking. Is in the .dll a fault?

Have anyone a solution?


P.S.:My English is not very well

QuestionHow can i add dynamic docking panel? Pin
guy__b4-Aug-04 5:01
memberguy__b4-Aug-04 5:01 
GeneralCosts $300 Pin
Any Mouse23-Jul-04 22:32
memberAny Mouse23-Jul-04 22:32 
GeneralRe: Costs $300 Pin
Jerry Maguire27-Jul-04 9:02
memberJerry Maguire27-Jul-04 9:02 
GeneralRe: Costs $300 Pin
motif812-Oct-05 20:16
sussmotif812-Oct-05 20:16 
GeneralDefault size in Doking Manager. Pin
Rodrigo F.P.7-Jul-04 7:00
memberRodrigo F.P.7-Jul-04 7:00 
GeneralChange Docking Manager default size Pin
Rodrigo F.P.7-Jul-04 6:56
memberRodrigo F.P.7-Jul-04 6:56 
Generalabout toolbar's location Pin
huangjinzhansh28-Jun-04 23:28
memberhuangjinzhansh28-Jun-04 23:28 
GeneralRe: about toolbar's location Pin
cbumstead14-Apr-05 13:01
membercbumstead14-Apr-05 13:01 
Generalmaybe a bug Pin
Laisser27-Jun-04 8:30
memberLaisser27-Jun-04 8:30 
GeneralGrats !! + Small Bug with visualStyle + Info about the "System.ArgumentOutOfRangeException" Pin
Hadi.TALEB14-Jun-04 6:45
memberHadi.TALEB14-Jun-04 6:45 
GeneralRe: Grats !! + Small Bug with visualStyle + Info about the "System.ArgumentOutOfRangeException" Pin
Jerry Maguire14-Jun-04 12:40
memberJerry Maguire14-Jun-04 12:40 
Questiondocked window location? Pin
Petr M.20-May-04 5:13
sussPetr M.20-May-04 5:13 
GeneralForm doesn't show Pin
squidward25-Feb-04 2:35
membersquidward25-Feb-04 2:35 
GeneralRe: Form doesn't show Pin
Jerry Maguire25-Feb-04 6:24
memberJerry Maguire25-Feb-04 6:24 
GeneralSet size a panel during initializeComponent Pin
ckatili19-Feb-04 5:22
sussckatili19-Feb-04 5:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160525.2 | Last Updated 17 May 2013
Article Copyright 2003 by Chris Richner
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid