Data Binding for WPF

Source: Internet
Author: User
Data Binding is in the Application ProgramEstablish a connection between the UI and the business logic. If the binding has correct settings and the data provides correct notifications, the elements bound to the data automatically reflect the changes when the value of the data changes. Data Binding may also mean that if the external representation of the data in the element changes, the basic data can be automatically updated to reflect the changes.
In WPF, element dependency attributes can be bound to CLR objects (including ADO. Net objects or objects associated with Web Services and web properties) and XML data.

No matter what elements you want to bind, no matter what the characteristics of the data source are, each binding begins to follow the final model shown below:


As shown in, data binding is essentially a bridge between the binding target and the binding source. This figure demonstrates the following basic concepts of WPF Data Binding:

Generally, each binding has four components: bind the target object, target attributes, bind the source, and the path of the value in the binding source to be used. For example, if you want to bind the content of textbox to the name attribute of the employee object, the target object is Textbox, the target attribute is text, and the value to be used is name, the source object is the employee object.
The target attribute must be a dependency attribute. Most uielement attributes are dependency attributes, and most dependency attributes (except read-only attributes) support data binding by default. (Only the dependencyobject type can define the dependency attributes. All uielements are derived from dependencyobject .)

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.