Design-Time Metadata Attributes for Properties

xiaoxiao2021-03-06  108

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 buy by the designer to assign a value to the property. The value of the value That You Pass Into this attribute shouth be the same as the default value e 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. DesignerSerializationVisibilityAttribute 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.

转载请注明原文地址:https://www.9cbs.com/read-103246.html

New Post(0)