SandDock User Guide

Advanced Topics

Back to Table of Contents

Window Duality

Both dockable windows and tabbed documents inherit from DockControl, and simply set some default properties on this class. This means that you can, if you desire, enable complex docking scenarios like allowing the user to float your tabbed documents or even allowing them to dock them to the sides of your form, instead of in the centre.

This is an advanced operation, and the recommended practice for this is to do it programmatically rather than set the properties to let the user drag the window themselves. For instance, in Visual Studio it is possible to make the object browser window switch between tabbed document and dockable window state. This is achieved via the context menu that is displayed for the window.

Delay Loading Windows

When restoring a serialized SandDock layout it is normally a requirement that all windows be loaded and have their Manager property set before making the call. This means that when SandDock encounters a window reference in the stored layout information (windows are referenced by their Guid property) it can find the window and display it in the correct place.

There are some situations where you may not wish to load all your windows before restoring layout information. This may be because you have a lot of windows and loading them all upon application startup would be detrimental to performance. SandDock supports a means to overcome this problem.

The ResolveDockControl event of your SandDockManager is fired during a call to SetLayout whenever SandDock encounters a window reference whose Guid it cannot find in the current layout. In the method that handles this event, your application should examine the guid and create the dockable window to which it refers, passing it back to SandDock via the e.DockControl property. By cooperating with SandDock like this you enable delay loading of your windows.

DockSystemContainer

Every SandDock layout needs to have this property set on your SandDockManager. Usually, this is done for you by the designer. If you are designing a form, the property is set to your form. If you are designing a usercontrol, the property is set to your usercontrol. The control referenced by this property is the one which will parent all SandDock windows. It is rare that you would need to change it, but sometimes the need arises.

If you have a complex form on which you are using a toolbar layout library, you may wish to simplify your design by having a child control taking up the remainder of the form inside the toolbars. If you follow this design, you wish SandDock to keep itself within the bounds of this child control as opposed to the form itself. In this case, straight after adding your SandDockManager to the form you need to set this property to reference your child control.

Avoid changing the value of this property once you already have a layout configured, as moving all your windows from one container to another can cause the order in which the windows are displayed to change.

EnableTabbedDocuments

By default, SandDock treats windows docked in the middle of your form as tabbed documents. Any opened using the OpenDocked(ContainerDockLocation.Center) method will be opened in this fashion. However some interfaces do not require tabbed documents, and in fact need the entire form to be comprised of dockable windows.

In this situation you can change the value of this property to false. Note that changing the value of the property while there are windows already displayed in the centre of your form will result in an exception being thrown.

Be aware that windows docked to the centre of a form cannot be collapsed because they do not have an edge to collapse to.

Next: Layout Systems