asp.net Atlas Simple control introduction two base classes

Source: Internet
Author: User
Tags wrapper
Asp.net| control asp.net The concept of client-side controls in Atlas, encapsulating DOM elements that client-side JavaScript will manipulate with object-oriented thinking, bringing a clearer code model and better reusability (where inefficiencies are less). The client-side control of Atlas is a bridge between JavaScript and DOM elements, and we should use client controls as much as possible to deal with DOM elements, which is to write our programs in Atlas. At the same time, Atlas's powerful JavaScript-oriented expansion (see ASP.net atlas for JavaScript extensions) also makes it easy to build custom controls by inheriting, covering, and so on.

In some of the previous posts, I introduced some of the more complex controls in Atlas. But at the same time, Atlas also provides some simple/basic client controls that are also useful in development, allowing us to familiarize ourselves with the simple client controls that come with Atlas from the series.

All of the Atlas client controls inherit from the Sys.UI.Control base class, while Sys.UI.Control inherits from the Sys.Component base class, let's take a look at the properties that Sys.Component provides:

Id:atlas The identifier of the component to connect the Atlas client component with the DOM element. This ID value is the same as the id attribute value of the DOM element, which Atlas uses to find the relevant DOM element.

bindings: A collection of bindings for this component. For bindings in Atlas, refer to: Atlas Uncover-Bindings (Binding).

DataContext: The Action object for the binding of this component. If you set this property, all bound entries will inherit this object by default, but you can also override this default setting in the declaration of the binding.

isinitialized: A Boolean value that represents whether the component has been initialized. Read-only.

isupdating: This component is being updated and is true at the beginning of the call to the BeginUpdate () method to the EndUpdate () method, and the other time is false. Read-only.

Sys.Component also provides the following methods:

beginupdate and EndUpdate: Depending on the implementation of the base class, you can delay or update a batch of components by calling both methods to improve performance or reduce screen flicker.

Initialize: Constructors, needless to say, an inheriting class can extend the method and initialize its own members.

There are also the following events: PropertyChanged: This event should be raised when an attribute of a component changes. The implementation of the Atlas binding depends on this event.

Now let's look at the properties provided by Sys.UI.Control:

accesskey: Gets or sets the accessKey of the control, which is the wrapper for the AccessKey property in the DOM element.

associatedelement: Returns the associated DOM element for the control. This property should be passed to the constructor of the control and cannot be modified after construction.

behaviors: The behavior collection for this component. For behavior in Atlas, refer to: Create a custom behavior in ASP.net atlas.

CssClass: Gets or sets the CSS class for the control, which is the wrapper for the Class attribute in the DOM element.

Enabled: Represents whether the control is enabled, which is the wrapper for the Enabled property in the DOM element.

Parent: Gets or sets the parent control of the control.

style: Gets the Style property value of the DOM element corresponding to the control.

TabIndex: Gets or sets the tab index of the control.

VisibilityMode: Gets or sets the display mode of the control when it is hidden. Optional enumeration value: Sys.UI.VisibilityMode.Collapse represents the control when it is hidden and does not occupy the page space, and Sys.UI.VisibilityMode.Hidden still occupies its place when the control is hidden.

visible: Gets or sets whether the control is visible.

Sys.UI.Control also provides the following methods:

addCssClass: Adds a CSS Class to the control.

removecssclass: Deletes a CSS Class for the control.

Containscssclass: Returns a Boolean value that represents whether the control has the specified CSS Class.

toggleCssClass: If the control does not have a specified CSS Class, it is added and, if so, deleted.

Focus: Enables the control to get input focus.

scrollIntoView: Causes the control to scroll to the visible range of the screen.

onbubbleevent: Handles the bubble event emitted by the child control of the control.

RaiseBubbleEvent: This method invokes the OnBubbleEvent method of all the parent controls of the control to implement the bubble event.

In the next few, I'll introduce the Atlas built-in controls that inherit or indirectly inherit from Sys.UI.Control, hopefully not as boring as this article.

Related Article

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.