Skip to main content
A newer version of this page is available. .

Workspace Manager

  • 3 minutes to read

Many DevExpress controls provide methods to save their current layouts to a file, registry or stream, and then restore these layouts later on. These methods are sufficient when you need to manage a layout for one particular control. On the other hand, when your application contains multiple controls (toolbars, grid, navigation bar, etc.), saving/restoring the layout of each one of them manually becomes complicated. In such a case, the perfect solution would be to utilize the Workspace Manager (WorkspaceManager) component.

The Workspace Manager is a compact tool that detects all supported DevExpress controls within the target container (form, user control) and operates their layouts as one global application layout, called workspace. The list below enumerates major DevExpress controls supported by the Workspace Manager.

You can create multiple predefined application workspaces that your users will be able to choose from, as well as save and restore their own custom workspaces.

Getting Started (online video)

Concepts

The manager uses four methods that operate workspaces.

As you may have noticed, all of these methods work with the WorkspaceManager.Workspaces collection - the place where all active workspaces are stored. Active workspaces are those that are ready to be applied. If a workspace is stored in a file but has not been loaded yet, it is considered inactive. To add predefined workspaces to your application as active workspaces, design them first, then save to XML files and load when the application starts, for instance on the FormLoad event.


private void Form1_Load(object sender, EventArgs e) {
    workspaceManager1.LoadWorkspace("Default", @"default.xml");
    workspaceManager1.LoadWorkspace("Compact", @"compact_layout.xml");
    workspaceManager1.LoadWorkspace("Detailed", @"full_layout.xml");
}

The manager searches for all supported controls within the object, assigned to its WorkspaceManager.TargetControl property.

Bar Workspace Menu

To assist both you and your end-users in creating, saving and loading workspaces, the Workspace Manager provides a bar menu, represented by the BarWorkspaceMenuItem class. This item can be added to the required Bar or RibbonControl as the image below illustrates.

WSM - Bar Item

By default, this item only displays the active workspaces list and a button to capture the current workspace.

WSM - Default Menu

You can set the button’s ShowSaveLoadCommands property to true to display additional commands, which allow your end-users to save and load workspaces at runtime.

WSM - Full Menu

You can use this menu when developing the application to quickly design and save to files various layout versions. Afterwards you can set the ShowSaveLoadCommands property back to its default false value.

Switching between workspaces can be followed by animation effects. You can choose from eight animation types, available out-of-the-box, by selecting them from a control’s smart-tag. To do the same in code, create the required animation and assign it to the WorkspaceManager.TransitionType property.


DevExpress.Utils.Animation.PushTransition pushTransition1 = new DevExpress.Utils.Animation.PushTransition();
workspaceManager1.TransitionType = pushTransition1;

Example

How to use WorkspaceManager for capturing, applying, saving and loading workspaces