[Expand]General Information
[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
 [Collapse]Common Concepts
  [Expand]Themes
  [Expand]Images
  [Expand]Printing and Exporting
  [Collapse]Saving and Restoring Layouts
    Saving and Restoring Layout Basics
    Layout Options
   Typed Styles
  [Expand]Touch Support
  [Expand]Expressions
  [Expand]Formatting Values
   Prism Adapters
  [Expand]Data Sources
  [Expand]Performance Improvement
   XAML Namespaces
 [Expand]MVVM Framework
 [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]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Layout Options

When a control's layout is saved to a data store, a specific set of properties is saved by default. For example, in the DXGrid control these include the visibility state of the entire control, the position and size of the columns/fields, sorting, grouping and summary information, settings that determine the visibility of various individual visual elements, etc.

By default, only predefined settings are saved. A property is saved/restored if it meets the following requirements.

  • The property must be marked with an DevExpress.Utils.Serializing.XtraSerializableProperty attribute.

    Note

    DXGrid and DXPivotGrid provide the GridStoreAlwaysProperty and PivotStoreAlwaysProperty attributes, respectively. Properties marked with these attributes are always saved.

  • The local value of the property must be set.

It is possible to manually specify which properties should be saved. This can be done in two ways: using the DXSerializer.StoreLayoutMode attached property or by handling the DXSerializer.AllowPropertyEvent attached event.

Expanded Select Settings via the StoreLayoutMode Attached Property

The following table describes the DXSerializer.StoreLayoutMode property values.

Option

Description

DXSerializer.StoreLayoutMode

Specifies which settings should be saved.

Property Values:

None - only those settings that are marked with the special attribute (DXGrid: GridStoreAlwaysProperty; DXPivotGrid: PivotStoreAlwaysProperty) are saved/restored.

All - all settings that are marked with the XtraSerializable attribute and have their local value set are saved/restored. These generally include the visual, data-aware, behavior and customization options.

UI (Default Value) - only those settings that are marked with the GridUIProperty attribute are saved/restored. These include the visibility state, position and size of columns, sort and group settings, and summary information.

Expanded Select Settings by Handling an Event

To manually control which settings should be saved, handle the DXSerializer.AllowPropertyEvent attached event. The event parameter's DependencyProperty property represents a property that should be saved/restored. To save it, set the event parameter's Allow property to true. To see an example, refer to the How to: Select Properties to be Saved when Saving the Grid Layout topic.

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