Back to Devexpress

NonUniqueControlNameException Class

windowsforms-devexpress-dot-xtrabars-dot-docking2010-dot-views-7d2783f0.md

latest2.3 KB
Original Source

NonUniqueControlNameException Class

Occurs when the restored layout contains documents with duplicate ControlName properties.

Namespace : DevExpress.XtraBars.Docking2010.Views

Assembly : DevExpress.XtraBars.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[LogifyIgnoreException]
public class NonUniqueControlNameException :
    RestoreLayoutException
vb
<LogifyIgnoreException>
Public Class NonUniqueControlNameException
    Inherits RestoreLayoutException

Remarks

Follow the steps below to fix this exception:

  1. Handle the BaseView.RestoreLayoutError event.
  2. Assign a new unique name to the NonUniqueControlNameException.ControlName property.
csharp
void tabbedView1_RestoreLayoutError(object sender, DevExpress.Utils.Serializing.RestoreLayoutErrorEventArgs e) {
    foreach (var exception in e.Exceptions) {
        if (exception is NonUniqueControlNameException nonUniqueException)
            nonUniqueException.ControlName = $"{nonUniqueException.ControlName}_1";
    }
    e.Throw = false;
}

Inheritance

Object Exception SystemException InvalidOperationException DevExpress.Utils.Serializing.RestoreLayoutException NonUniqueControlNameException

See Also

NonUniqueControlNameException Members

DevExpress.XtraBars.Docking2010.Views Namespace