OptionsLayoutBase.LayoutVersion Property
Gets or sets the version of the layout.
Namespace: DevExpress.Utils
Assembly: DevExpress.Data.v24.1.dll
NuGet Package: DevExpress.Data
Declaration
Property Value
Type | Description |
---|---|
String | A string representing the version of the layout. |
Property Paths
You can access this nested property as listed below:
Library | Object Type | Path to LayoutVersion |
---|---|---|
Cross-Platform Class Library | OptionsLayoutBase |
|
PropertyAllowEventArgs |
|
|
WinForms Controls | BaseView |
|
SchedulerControl |
|
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.
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the LayoutVersion property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.