Method EnsureChild
EnsureChild<T>(string?, Action<T>?, Action<T>?, EnsureSideBarChildFlags)
Ensures that a child control of the specified type exists within one of the tabs.
public virtual T EnsureChild<T>(string? title = null, Action<T>? onCreate = null, Action<T>? onUpdate = null, TabControl.EnsureSideBarChildFlags flags = EnsureSideBarChildFlags.None) where T : AbstractControl, new()
Parameters
titlestringAn optional title to associate with the child control if a new instance is created.
onCreateAction<T>The action to execute when creating the child control.
onUpdateAction<T>The action to execute when updating the child control.
flagsTabControl.EnsureSideBarChildFlagsThe flags for additional options.
Returns
- T
An instance of the specified type
T. If a child of this type already exists, it is returned; otherwise, a new instance is created, added to the collection, and returned.
Type Parameters
TThe type of the child control to ensure, which must derive from AbstractControl and have a parameterless constructor.
Remarks
This method checks the existing collection of child controls and
returns the first
instance of the specified type T if found.
If no such instance exists, a new instance
is created, optionally associated with the provided title, and added
to the collection.