DockManager.LayoutVersion Property

Gets or sets the version of the layout of dock windows.

Namespace: DevExpress.XtraBars.Docking

Assembly: DevExpress.XtraBars.v20.1.dll

Declaration

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

Property Value

Type Default Description
String

String.Empty

A string representing the version of the layout of dock windows.

Remarks

You should assign versions to layouts, if you need to customize the layout of dock panels after a previous version of the layout has been loaded from a data store (a stream, xml file or system registry) and applied to the control.

Consider this example. An earlier version of an application contained one dock panel (Panel1). When running the application an end-user saved the layout of the dock windows to an XML file. Then a new version of the application was designed. For example, it added another panel (Panel2). By default, when the previously saved layout is loaded within the new application the current layout of the dock windows will be overridden. Only Panel1 will be visible. Panel2 will be hidden.

To enable end-users to work with previously saved layouts, and ensure that new features and dock panels will still be visible after old layouts have been loaded, you should do the following:

  • When designing a new version of the control's layout, set the version via the LayoutVersion property. Ensure that the version of the current control's layout differs from the version of the saved layouts.
  • Handle the DockManager.LayoutUpgrade event to implement a routine that will upgrade old layouts. 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 example, in the event handler you can make specific dock panels visible.

    For the above example you could handle the LayoutUpgrade event to display Panel2 at a specific position within the form.

Examples

Suppose an earlier version of an application contained one dock panel (dockPanel1). When running the application, an end-user saved the layout of the dock windows to an XML file. Then, a new version of the application was designed. For example, it added another panel (dockPanel2). By default, when the previously saved layout is loaded within the new application, the current layout of the dock windows will be overridden. Only dockPanel1 will be visible. dockPanel2 will be hidden.

To enable end-users to work with previously saved layouts, and ensure that new features and dock panels will still be visible after old layouts have been loaded, you should specify the layout versions via the DockManager.LayoutVersion property, and handle the DockManager.LayoutUpgrade event:

In this example, the new dockPanel2 panel is registered within the dock manager and then docked to the bottom of the window.

private void dockManager1_LayoutUpgrade(object sender, 
DevExpress.Utils.LayoutUpgradeEventArgs e) {
    dockPanel2.Register(dockManager1);
    dockPanel2.DockTo(DevExpress.XtraBars.Docking.DockingStyle.Bottom);
}
See Also