LayoutControl.RequestUniqueName Event
Allows you to provide unique names for layout items created in code, whose names conflict with existing names.
Namespace: DevExpress.XtraLayout
Assembly: DevExpress.XtraLayout.v24.1.dll
NuGet Package: DevExpress.Win.Navigation
Declaration
Event Data
The RequestUniqueName event's data class is DevExpress.XtraLayout.Utils.UniqueNameRequestArgs.
Remarks
To correctly save the layout to a data store (an XML file, stream or the system registry), layout items must have unique names. For layout items created in code, you should give them unique names. You can assign names via the Name property of layout items, or handle the RequestUniqueName event to provide unique names. If you do not provide unique names, the LayoutControl will assign unique names itself.
The RequestUniqueName event occurs when saving the LayoutControl’s layout to a data store, and only if names of specific layout items match. The event fires repeatedly for each layout item whose name is empty or conflicts with other names.
The event’s TargetItem parameter identifies the current conflicting item. The ExistingNames parameter represents a hashtable that contains unique names that have been processed so far. The hashtable’s key specifies an item’s name, while the hashtable’s value refers to the corresponding item.
To specify the name for the item, use the Name property of the TargetItem parameter. Ensure that the name doesn’t conflict with names in the ExistingNames hashtable.
Conflicting names will also be corrected if the RequestUniqueName event is not handled.