ASP.net 3.5 control and Component Development Technology series-server control properties (v)

Source: Internet
Author: User

4.7 Implementing Custom Properties

Many of the features we implement in the previous chapters of this chapter are implemented with the help of system-provided design-time metadata attribute support, such as:

Displays the Description property of the property description information

[Description ("Descriptive text")]

Specifies the category design property of a property in a category in the Properties window

[Category (Category name in Property window)]

Specify editor design properties for the property editor

[Editor (typeof (Filenameeditor), typeof (UITypeEditor))]

Specify the TypeConverter design properties of the property type converter

[TypeConverter (typeof (Solidcoordinateconverter))]

These are provided by the system, and each property has its own function. So what if we want to customize a design attribute and implement a custom function? To design a custom attribute, you only need to derive it directly or indirectly from System.Attribute, exactly as the traditional class feature does. We can either use System.Attribute to define control design period control or use System.Attribute to specify Run-time control.

This section demonstrates how the design properties in the control are implemented as an example. First, let's explain the functionality that this section controls properties to implement, as shown in Figure 4-35.

This control has a num property that allows developers to specify a value. A validation property of the Numvalidate type is specified on the control's properties, which requires that two parameters be passed in for the developer to specify an interval, and a warning prompt (such as the red warning hint in Figure 4-36) is provided if the property specified in the Properties window is not within the range.

Figure 4-36 Example of control design properties

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.