Supported Property Attributes
The data models and factories are designed to support all the common property attributes found in namespaces like System.ComponentModel
and System.ComponentModel.DataAnnotations
. These property attributes can help control everything from display name to description to visibility and much more.
System.ComponentModel Attributes
The System.ComponentModel
attributes in the table below are supported. The more commonly-used attributes include usage examples.
Attribute | Description |
---|---|
|
Specifies another See MSDN (external) for more information on this attribute. |
|
Indicates whether a property should be displayed. This attribute is compared to the PropertyGrid.BrowsableAttributes, which defaults to a This code shows an example of applying
See MSDN (external) for more information on this attribute. |
|
Specifies the name of the category in which to group the property. When PropertyGrid.IsCategorized is set to This code shows an example of applying
See MSDN (external) for more information on this attribute. |
|
Specifies the default value for a property. The default value can be used to determine if a property has been modified, or when resetting a property. The value specified by this attribute takes precedence over the This code shows an example of applying
See MSDN (external) for more information on this attribute. |
|
Specifies a description for a property. The description is displayed in the summary area of a property grid. This code shows an example of applying
See MSDN (external) for more information on this attribute. |
|
Specifies the display name for a property. The display name is typically a user friendly version of the property name (e.g., This code shows an example of applying
See MSDN (external) for more information on this attribute. |
|
Specifies the editor to use to change a property. In the context of property grid, this attribute can be used to specify the property editor used for selecting a name cell or value editor cell This code shows an example of applying
See the Property Editors for more information on how to use this attribute. See MSDN (external) for more information on this attribute. |
|
Specifies that an object is immutable and has no child properties capable of being edited. Child properties of immutable objects cannot be modified. See MSDN (external) for more information on this attribute. |
|
Indicates whether a property can be combined with other properties, when multiple selected objects are being modified at once. See the Multiple Objects topic for more information on property merging. See MSDN (external) for more information on this attribute. |
|
Indicates whether the parent property is notified when the value of the property that this attribute is applied to is modified. See MSDN (external) for more information on this attribute. |
|
Indicates whether the name of a property is displayed within parentheses (e.g., This attribute is typically used to sort more important properties to the top, when sorting alphabetically. However, other sorting features can alter sort order. In addition, the parentheses make the property stand out slightly. See MSDN (external) for more information on this attribute. |
|
Indicates whether a property is read-only or read/write. Properties that do not have a This code shows an example of applying
See MSDN (external) for more information on this attribute. |
|
Specifies a
A custom See MSDN (external) for more information on this attribute. |
|
Specifies the custom This is currently only supported by the See MSDN (external) for more information on this attribute. |
System.ComponentModel.DataAnnotations Attributes
The System.ComponentModel.DataAnnotations.dll assembly has other attributes that can be used by property data and factories.
The System.ComponentModel.DataAnnotations
attributes in the table below are supported. The more commonly-used attributes include usage examples.
Attribute | Description |
---|---|
|
Provides a general-purpose attribute that lets you specify sort order and localizable strings for category, display name, description. This attribute can be used in place of This code shows an example of applying
See MSDN (external) for more information on this attribute. |
|
Indicates whether a property is editable. This attribute is similar to When not specified, the property is editable by default if there is a This code shows an example of applying
See MSDN (external) for more information on this attribute. |
Browsable Properties
The properties returned by the built-in factories can be filtered based on a set of "browsable attributes". These attributes, which are defined in the BrowsableAttributes property, must be explicitly defined on a property or must be the default value for the given attribute Type
. In addition, any settings stored by the attribute must be equal, such as the BrowsableAttribute.Browsable
.
The default value of BrowsableAttributes
contains only one entry, which is BrowsableAttribute.Yes
. This is a statically defined instance of BrowsableAttribute
that indicates a property is browsable. If a property does not explicitly define a BrowsableAttribute
, then it is assumed to be browsable. Therefore, the default setting BrowsableAttributes
filters out properties that have been explicitly marked with BrowsableAttribute.No
.