Essential Silverlight 3- P6: Khái quát Silverlight 3 không chỉ là lấp đầy với các chi tiết kỹ thuật, ví dụ rõ ràng, và thực hiện lời khuyên rằng sẽ làm cho bất kỳ ứng dụng Silverlight tốt hơn, nhưng Ashraf cũng bao gồm những hiểu biết rằng chỉ có thể đến từ một trong những nhà phát triển dẫn của thời gian chạy Silverlight. Từ đồ họa, văn bản, để phương tiện truyền thông cuốn sách này- có tất cả các thông tin cần thiết về thời gian chạy lõi 3 Silverlight | 218 Chapter 10 Data Binding new Binding Manager DataContext Inheritance In the previous example the MainPage constructor set the DataContext property whereas its child TextBlock elements specified the binding. This usage pattern works because the DataContext property is an inherited property that is Silverlight determines the value of the property by finding the nearest parent element with the property explicitly set. You can reset a binding object connection by either calling the ClearValue method for the property or by setting the property to some other explicit value. Technical Insight Silverlight only provides built-in markup extensions you cannot define your own. Future Silverlight versions will likely let you write your own markup extensions. The most general form of a markup extension is syntax for creating an object and providing that object with a FrameworkElement instance and the DependencyProperty to set. Technical Insight Silverlight freezes a binding object when you set the binding to a property and you will no longer be able to modify the binding properties. DEBUGGING TIP Errors in binding connections do not throw exceptions by default. To determine why a connection has failed you can view the error messages in your debugger output window. Later in this chapter you will learn how to enable data-binding exceptions. Please purchase PDF Split-Merge on to remove this watermark. Data Binding Objects 219 Data Synchronization and Binding Modes After establishing a binding between a data object and an element property you may need to synchronize data values when the data object properties change or if the element property changes. For example if the data that is bound to a control changes the binding needs to notify the control to update its displayed value. If a control value changes the binding may need to write the data back to a data store. To use data binding to synchronize your data