CSDN博客

img liushmh

Design-Time Metadata Attributes for Properties

发表于2004/10/21 11:17:00  506人阅读

Attribute

Description

BindableAttribute

Specifies whether it is meaningful to bind data to the property. We'll discuss data binding in Chapter 16, "Data-Bound Controls."

BrowsableAttribute

Specifies whether the property should be displayed in the property browser. By default, a public property is always displayed in the property browser. Apply this attribute as Browsable(false) only if you do not want a property to be displayed. You should generally mark read-only properties as Browsable(false).

CategoryAttribute

Specifies the category that a property should be grouped by in the property browser. When the page developer selects the category filter, this attribute makes it possible to organize properties in logical groupings, such as Appearance, Behavior, Data, and Layout.

DefaultValueAttribute

Specifies a default value for the property, which is used by the designer to assign a value to the property. The value that you pass into this attribute should be the same as the default value returned by the property.

DescriptionAttribute

Provides a brief description of the property that is displayed at the bottom of the property browser when the page developer selects the property.

DesignerSerialization­VisibilityAttribute

Specifies whether and how a property should be serialized in code. For example, you should mark a read-only property as DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden) so that the property is excluded from the designer's serialization mechanism. You will see an example of this attribute in the PageTracker example in the next section. We'll discuss this attribute in more detail in Chapter 10.

阅读全文
0 0

相关文章推荐

img
取 消
img