System.ComponentModel Namespace
Provides classes for implementing and managing custom components and controls. This namespace is fundamental to building Windows Forms and other UI frameworks in the .NET ecosystem.
Namespaces
This namespace does not contain any sub-namespaces.
Classes
- CategoryAttribute Used to group properties and events in the Properties window.
- DefaultBindingPropertyAttribute Specifies the default binding property for a component.
- DescriptionAttribute Provides a string to describe a property or event.
- DesignerAttribute Specifies a designer for a component.
- DesignerSerializationVisibilityAttribute Specifies the visibility of a property during designer serialization.
- DisplayNameAttribute Specifies the display name for a property or event.
- EditorAttribute Specifies an editor for a property or event.
- InitializationAttribute Marks methods that are called during initialization.
- InstallerAttribute Specifies an installer for a component.
- LocalizableAttribute Indicates whether a property can be localized.
- ReadOnlyAttribute Indicates whether a property is read-only.
- RefreshPropertiesAttribute Indicates that a property should be refreshed.
- TypeConverterAttribute Specifies a type converter for a property or type.
- ToolboxBitmapAttribute Specifies a bitmap to be displayed for a component in the Toolbox.
- DesignerSerializationAttribute Specifies how a property should be serialized by the designer.
- DesignTimeVisibleAttribute Specifies whether a component should be visible at design time.
Interfaces
- IComponent Represents a component that can be part of a larger application.
- IContainer Represents a container that holds components.
- IDesigner Represents a designer for a component.
- IExtenderProvider Represents an object that provides properties to other objects.
- ITypeDescriptorContext Provides type information and context information for a property or attribute.
Structs
- PropertyDescriptor Represents a property of a component.
- EventDescriptor Represents an event of a component.
Enums
- DesignerSerializationVisibility Specifies the visibility of a property during designer serialization.
- RefreshProperties Specifies how a property should be refreshed.
Key Concepts
The System.ComponentModel
namespace is central to building interactive applications within the .NET Framework. It provides a rich set of attributes, interfaces, and classes that enable:
- Design-time Extensibility: Allowing developers to extend the functionality of the Visual Studio designer, such as adding custom property editors, creating custom designers, and controlling how components are displayed.
- Component Model: Defining a standard way for objects to interact and be managed within a larger application or design environment.
- Data Binding: Facilitating the connection between data sources and UI elements through interfaces like
IBindingList
and attributes likeDefaultBindingPropertyAttribute
. - Attribute-Based Configuration: Using attributes to declaratively configure the behavior and appearance of components, reducing the need for verbose code.
Commonly Used Attributes:
Attribute | Description |
---|---|
[CategoryAttribute] |
Groups properties in the Properties window. |
[DescriptionAttribute] |
Provides tooltip text for properties and events. |
[DisplayNameAttribute] |
Sets the name displayed for properties and events in the designer. |
[ReadOnlyAttribute] |
Marks a property as read-only in the designer. |
[TypeConverterAttribute] |
Specifies a custom type converter for a property or type. |