[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Collapse]Form Layout Managers
    Side Panel
   [Expand]Layout and Data Layout Controls
   [Expand]Tabbed MDI Manager
    Tab Control
   [Expand]Wizard Control
    Workspace Manager
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com

Workspace Manager

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 any of the following components:

  • Workspace Manager (WorkspaceManager) - Allows you to manually save the layout information to a file or stream. Supports multiple layouts (workspaces) and animation effects.
  • Persistence Behavior (part of the Behavior Feature) - Automatically saves the layout information to a file or the system registry when the Form.FormClosed event fires and restores the saved layout when the Form.Load event fires.

We do not recommend saving layouts to the system registry because the amount of data can be too large. Save layouts to a file or stream instead.

The Workspace Manager 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.

If you do not want a specific control's layout to be saved, call the WorkspaceManager.SetSerializationEnabled method and pass this unwanted control as a method parameter.

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.

Expanded Getting Started (online video)

Expanded 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.

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

Expanded Example

The following code shows how to use the WorkspaceManager component to save the form's bounds and state, and the layout of DevExpress controls when a form is closed, and load this layout when the form starts.

You may need to call the controls' ForceInitialize methods (e.g., GridControl.ForceInitialize) before applying layouts to the controls in a Form.Load event handler.

Expanded 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.

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

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.

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.

Expanded Example

Expanded See Also

Is this topic helpful?​​​​​​​