Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]Welcome to DevExpress .NET Documentation
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Collapse]WPF Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Collapse]MVVM Framework
  [Expand]ViewModels
  [Expand]Commands
  [Expand]Behaviors
  [Collapse]Services
    Getting Started
    Services in ViewModelBase descendants
    Services in POCO objects
    Services in custom ViewModels
    View creation mechanisms
   [Collapse]Predefined Set
    [Expand]Dialog Services
    [Expand]Message Box Services
    [Expand]Document Services
    [Expand]ViewInjectionService
    [Expand]Report Services
     NotificationService
     TaskbarButtonService
     ApplicationJumpListService
     DXSplashScreenService
     DispatcherService
     FrameNavigationService
     LayoutSerializationService
     FolderBrowserDialogService
     OpenFileDialogService
     SaveFileDialogService
     WizardService
     NotifyIconService
    How to create a Custom Service
  [Expand]DXBinding
  [Expand]MIF
   Converters
   ViewLocator
   Messenger
   Data Annotation Attributes
   LayoutTreeHelper
   Weak Event
 [Expand]Controls and Libraries
 [Expand]Scaffolding Wizard
 [Expand]Localization
  Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

LayoutSerializationService

LayoutSerializationService is an ILayoutSerializationService implementation that allows you to save/restore layout of serializable DevExpress WPF Controls located on a View.(i.e., DXGrid, DXPivotGrid, DXDocking, DXBars and DXLayoutControl).

Expanded Getting Started with the LayoutSerializationService

To save/restore a layout of your View and its child element, add the LayoutSerializationService to the View's dxmvvm:Interaction.Behaviors collection.

Then, use one of the following ways to access the defined service.

Next, call the service's Serialize/Deserialize method to save/restore the View's layout respectively. The Serialize method returns a string object that contains layout settings that you can restore by using the Deserialize method in the sequel. To restore a specific layout, pass the corresponding string object to the Deserialize method using its parameter.

When the Serialize/Deserialize method is invoked, the LayoutSerializationService iterates through visual tree elements and saves/restores the layout of controls supporting serialization and their child elements by using the DevExpress.Xpf.Core.Serialization.DXSerializer methods. Therefore, to properly perform serialization and deserialization, follow the recommendations described in the Saving and Restoring Layout Basics thread.

Tip

If you use LayoutSerializationService in conjunction with CurrentWindowSerializationBehavior, use the Initialized event to deserialize the layout on the application startup. Otherwise, the window may flicker during the deserialization.

Expanded Serialization Capabilities

To prevent a specific control and its child elements from being serialized/deserialized, set the attached dx:DXSerializer.Enabled property to False for this control.

Expanded Example

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=T273165.

Expanded See Also

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