In my previous post I pointed out the most common used Attributes for Design Time Support. In this part I will point out some more Attributes that take advantage of the Design Time Environment.
|DisplayName||Properties & Events||Specifies the display name for a property or an event.|
|ParenthesizeProperty||Properties||Indicates whether the name of the associated property is displayed with parentheses in the Properties window.|
|RefreshProperties||Properties||Indicates that the property grid should refresh when the associated property value changes.|
|NotifyParentProperty||Properties||Indicates that the parent property is notified when the value of the property that this attribute is applied to is modified.|
|ReadOnly||Properties||Specifies whether the property this attribute is bound to is read-only or read/write.|
Specifies whether a property can only be set at design time.
» DisplayNameAttribute is useful when you need the name displayed in the PropertyWindow different than property actual name.
[DisplayName("Number of Clicks")]
public int NumOfClicks
» ParenthesizePropertyAttribute when you have a special property such as Name and need it to appear between brackets this is the attribute to use.
public string SpecialProperty
» RefreshPropertiesAttribute when you have property's value which depends on the value of another one then you will need this attribute, mark the property that when changed should refresh others with this attribute.
public string RefreshOtherProperty
» NotifyParentPropertyAttribute Apply Size property has two nested properties: height and width. These nested properties should be marked with NotifyParentPropertyAttribute(true) so they notify the parent property to update its value and display when the property values change.to a property if its parent property should receive notification of changes to the property's values. For example, the
public string NotifyparentProperty
» ReadOnlyAttribute When applying this attribute with parameter true then it will be unchangable in the design time, this is different than making a property without a set accessor since properties marked with ReadOnlyAttribute can be changed using code.
public string ReadOnlyProperty
» DesignOnlyAttribute from the name implies that the property marked with this attribute will only be available in the design mode.
public string DesignTimeOnlyProperty