Design-Time Metadata Attributes for Properties

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值