IComponentInitializer Interface

Definition

Provides a set of recommended default values during component creation.

C#
public interface IComponentInitializer
Derived

Remarks

The IComponentInitializer interface can be implemented by any designer, which is a component that also implements IDesigner, which receives a recommended set of default values for the component it is designing. IComponentInitializer is queried during new component creation. Recommended default values for the component's properties are passed in as name/value pairs in a dictionary.

This design provides two customization points: the toolbox item itself can be replaced or changed to perform custom actions, or the designer for a component can be changed to provide a custom action. A designer that implements IComponentInitializer should not depend on either of its methods - InitializeNewComponent or InitializeExistingComponent - being called, because toolbox items are not obligated to call these methods.

For an overview of creating design components, see Extending Design-Time Support.

Methods

InitializeExistingComponent(IDictionary)

Restores an instance of a component to its default state.

InitializeNewComponent(IDictionary)

Initializes a new component using a set of recommended values.

Applies to

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

See also