SandDock User Guide Using SandDock The SandDockManager To begin using SandDock on your form or usercontrol you will need to place an instance of SandDockManager on it. This class will be present in your toolbox if you have added the SandDock library there. When you add a SandDockManager it automatically creates a default dockable windows, docked to the right-hand side of the container. You should never delete your SandDockManager, unless you want to completely get rid of SandDock from your form. Using any of SandDock's functionality, with the exception of the standalone TabControl control, requires a SandDockManager instance. The manager exposes certain properties, methods and events that pertain to the layout as a whole, and these will be useful to you as you integrate more and more features from SandDock. For instance, the ActiveTabbedDocumentChanged event will be useful to you when you want to change elements of your user interface based on which document the user last interacted with. The DockingStarted and DockingFinished events are useful when you need to display some text to the user in your statusbar to help them with their docking operation. There should only ever be one SandDockManager instance per form or container. Here is a list of properties on SandDockManager and their functions:
Creating a Window Layout To start with, drop a SandDockManager instance on your form. It will add a dockable window on the right. Whenever you have either the SandDockManager or your form (or usercontrol) selected, two verbs will be available to you in the PropertyGrid: Add Dockable Window and Add Tabbed Document. Try clicking them - the first will create a new dockable window and dock it at the right of your form, the second will create a new tabbed document and open it in the centre. SandDock's advanced design-time capabilities mean that you can dock windows at design-time just like you can at runtime. Try grabbing the tab or titlebar of any of the windows you have created and dragging it to another location. Hints will show you where the window will end up, and releasing the mouse button will commit the operation. By creating and redocking windows like this you can create your form layout at design-time with almost the same degree of flexibility with which your users can customise it later. When you create windows like this, you can place controls inside of them just like you can with any other container. They support automatic scrolling too, if you need to put more child controls inside them than will fit. Both dockable windows and tabbed documents support text and images on their tabs. The text on dockable windows can be different from the text on their titlebars by using the TabText property. By default this property simply echoes the Text property. This is all that is required to get an advanced windowing system up and running in your application. Designable Controls With version 2.0, SandDock introduced the concept of designable controls. Just like the UserControl class you are probably already familiar with, you can design a user dockable window or a user tabbed document in a standalone fashion, then add as many instances of it to your forms later on as you please. This promotes encapsulation of functionality and is an ideal way to write more advanced applications where code re-use is paramount. To create a new window in design mode, go to Project -> Add New Item. At the top of the list should be Dockable Window and Tabbed Document. Choose one and press OK, and you will see the class added to your solution and the window opened in design mode. It doesn't look very exciting to begin with - just a blank surface like a UserControl. Add some controls to it, then build your project. Next, open an existing form in design mode. If you look in your toolbox you will see that SandDock has added a new tab entitled "My User SandDocks". Under this tab will be all the designed windows in your solution, including both dockable windows and tabbed documents. Double-click one to add it to the form you are designing. If you do not already have a SandDockManager on the form, one will be created for you. You can now add as many instances of your dockable window as you like. Any child controls of your window are not selectable; it is treated as one control on the design surface. Setting Window Capabilities By default, SandDock allows as much user-customisation of your window layout as Visual Studio allows. Windows can be collapsed, pinned, floated, closed and resized. While you may want the user to be able to do all these things, sometimes it is necessary to restrict the potential operations on any given window. The following properties on every dockable window and tabbed document are designed to help with this.
|