Method EnsureChild
EnsureChild<T>(SplitPanelPosition)
Ensures that the specified panel position contains a child of the specified type.
public virtual T EnsureChild<T>(SplitPanelPosition position) where T : AbstractControl, new()
Parameters
positionSplitPanelPositionThe position of the panel where the child control should be ensured.
Returns
- T
An instance of the specified child control type
T. If the panel already contains a child of the correct type, that instance is returned; otherwise, a new instance is created and returned.
Type Parameters
TThe type of the child control to ensure. Must be a subclass of AbstractControl and have a parameterless constructor.
Remarks
This method checks if the panel at the given position already
has a child of the specified type. If not, it creates a new instance of the
type T and assigns it as the
child. If a child of a different type is present, an exception is thrown.
Exceptions
- InvalidOperationException
Thrown if the panel at the specified position already contains a child of a different type than
T.