OptionsLayoutBase.LayoutVersion Property

Gets or sets the version of the layout.

Namespace: DevExpress.Utils

Assembly: DevExpress.Data.v19.2.dll

Declaration

[DefaultValue("")]
public string LayoutVersion { get; set; }
<DefaultValue("")>
Public Property LayoutVersion As String

Property Value

Type Default Description
String

String.Empty

A string representing the version of the layout.

Remarks

You should assign versions to layouts if you need to customize the control after an earlier version of the control's layout has been loaded and applied to the control.

Suppose an earlier version of an application was released and this contained a control (for instance, the XtraGrid) which had two columns (ID and Name). When running the application an end-user saved the layout of the control to an XML file. Then a new version of the application was designed. For instance, it added a new column (Gender) and grouping by this column. By default, when the previously saved layout is loaded within the new application the current layout of the control will be overridden. The Gender column will not be destroyed by default (this depends upon the control's OptionsColumnLayout.AddNewColumns setting). It will appear in a specific position in the control but data will not be grouped by this column.

To solve the problem, i.e. to customize the control's layout after an old layout has been loaded you should do the following:

  • When designing a new version of the control's layout set the version via the LayoutVersion property. At a minimum you need to ensure that the version of the current control's layout differs from the version of the saved layouts.
  • Handle the control's LayoutUpgrade event to implement a routine that will upgrade old layouts (for the grid control, use the BaseView.LayoutUpgrade event). This event occurs after a previously saved layout has been loaded and only if its version doesn't match the version of the current control's layout.

    For the above example you could handle the LayoutUpgrade event to apply grouping by the Gender column.

See Also