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

Source: Internet
Author: User
Tags net xml attribute
The xml| control 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:

The first step: Make a Menu control under the. NET Platform

The custom controls below the .net platform work as follows: The control corresponds to a class, the control's properties 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.

Because here is important to explain the application of XML behind, so here is just the custom control of the original brief description, the following list of related objects, attributes, methods.

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

Control properties:

id: Identifying control names

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: Ditto

text: Text for top-level menus

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.

Author: Fengjie/aspcool



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.