SandDock for WPF User Guide

Using the Designer

Back to Table of Contents

Note that this page refers to the WPF designer, which is only available in Visual Studio 2008 and up. Visual Studio 2005 users can still make full use of SandDock features but they must do so using XAML only.

Adding the SandDock Controls

Firstly, ensure the SandDock controls (DockSite and DocumentContainer) are present in your toolbox. If not, right-click on the toolbox and select Choose Items. Switch to the WPF Components page then locate them in the list, they are easiest to find if you sort by assembly and look for the Divelements.SandDock assembly.

Drag an instance of DockSite out onto your form. You will notice that the designer gives it a default margin, this is usually best removed. The DockSite will then resize to fill its container fully, which is usually the desired behaviour. A DocumentContainer is added automatically as the child of the DockSite. If you wish to use something other than SandDock documents in the centre of your form, you can select and delete the DocumentContainer.

You will notice that when you added the DockSite, a dockable window was created automatically. If you run your solution at this point, the dockable window is fully operational and can be docked all around the form and even floated.

Creating and Manipulating Windows

When you have a DockSite in your window, you can right-click on any control in the design surface and you will see a New Window option, under which there are commands for creating docked windows on all four sides of the form, and for creating tabbed documents and MDI child windows too. Try creating a few. Note that once the child of your document container (SplitContainer or MdiContainer) has been created, only documents of that type can be added to your layout. To delete a window, select it and press delete. When you delete the last window in a group, the group is automatically deleted too.

Windows can be manipulated in largely the same way at design time as they can be at runtime. The only exception is that you cannot float a window at design time. Try clicking on the titlebar or tab for a window and dragging, and you will see the familiar "diamond" docking hints appear. When you move a window to one of these targets, the window will move, and your XAML code will be updated appropriately. The splitters used to resize SandDock windows also work at design time.

In addition to creating new windows on their own, you can right-click on an existing window and add a new window in its group, or split its group by adding a new window to the side of it. You can of course achieve the same thing by creating a standalone window and dragging it to that location.

There can be only one direct child of a SandDock window. Often this will be a TextBox or TreeView or similar, and the child is automatically sized so that it takes up the full space available to it in the window. You can of course add a Grid or other container, which will then allow you to add further children to it.

Useful Window Properties

At design time, the property grid is used for editing object properties. The properties you will use most are Title and Image, since these need to be customized for each window. Another useful property is DockingRules. In the property grid, this can be dropped down to reveal the individual docking rules for the window. This allows fine-grained control over what the user can do with it. You might wish to disallow docking in certain positions, or to allow a tabbed document to be floated. The checkboxes in the dropdown for the DockingRules property allow this.

Next: Taking Control