Application of XML to custom controls under. NET Platform (1)

Source: Internet
Author: User
Tags xml attribute

XML full name Extensible Markup Language (extensible marked language), which has been popular all over the world in recent years due to its unique advantages in data processing, cross-platform and so on. The XML language system handles any data as "keys" and "values", similar to many database management systems (DBMS), and is independent of specific machine instructions, and is stored in plain text files, and thus has excellent cross-platform performance. In addition, it allows users to create their own data instruction system, in the framework of this instruction system, users can transform all the information into easy to access data, greatly accelerated the development of the cycle and code portability.

Since XML is so good, what does it look like? Recently, the author has developed a menu control based on the. NET platform and added XML attribute because of the need of the subject. The following steps are made:

Step One: Create a Menu control under the. NET Platform

The custom controls below the. NET platform work as follows: The control corresponds to a class, and all properties of the control are exposed through the class's member variables, and the control's methods correspond to the member functions of class. In the hand that the control is loaded, the system calls the class's Render method, and when making the control, it should overload (override) The Render method so that the control can "draw" itself at the moment the control is loaded, in general, In the Render method, you put those JavaScript files that are drawn into the control interface into the output stream.

Since it is important here to explain the application of XML later, here is just a brief description of the original custom control, the following list of related objects, attributes, methods.

The entire menu control is divided into Topmenu,submenu,childrenmenu,menuitem four objects, and the corresponding information is:

Control properties:

ID: Identifying the name of the control

Menubarheight: The height of the menu stop

Menubarwidth:: The width of the menu bar

BorderWidth:: Border width

Autodropdown:true for automatic Drop-down, false table is mouse click dropdown

Dropdowndelay: Drop down time

Menufont: Fonts

Locationx: The x position of the menu

Locationy: The y position of the menu

Xmlfile:xml file

Xmlstream:xml Flow

Topmenu Object Properties:

ID: Ibid.

Text: Top-level menu texts

Isparent:true indicates that there is a next level menu, otherwise false (false default)

Islink: True is required for event handling, otherwise false (false default);

bgcolor: Background color

Forecolor: Foreground color

Hoveredbackcolor: The color of the mouse over the top

Topmenufont: Fonts

Linkurl: When Isparent is False, this indicates the URL of the connection

Borderwidth:topmenu Border Width

ItemHeight: The height of the next level menu (must be isparent to be true)

Itemwidth: The width of the next level menu (must be isparent to be valid)

Submenus: List of arrays containing the next level of menus

All the attributes of Submenu,childrenmenu and MenuItem are the same as the topmenu above.

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.