WPFwiki, wpf, wiki, .net 3.0, windows presentation foundation, FAQ, free resources, solution, development, microsoft Home of the world's largest WPF FAQ

Q5.4 - Binding Sources vs. Binding Target

Modified: Fri, 16 Mar 2007 14:24 by Jenny - Categorized as: WPF FAQ
Edit

Category

Data Binding

Edit

Question

What's the difference between Binding Source and Binding Target?

Edit

Answer

This is a question of what side of the fence you are on. Or rather what side of the fence you are looking at. The terms Binding Source and Binding Target are not representative of actions but rather of nature, meaning that Binding Source can be subject to read and write actions, as can Binding Target.

So, the Binding Source is where the data is kept. It is the repository, or a proxy of the repository, of the data. The binding source can be an object (a class instance) in memory or an XML node. These are the two data formats supported by WPF. Naturally, the XML node can be part of an XML document (an XML file), and the object can be part of a collection, including a .NET DataSet.

The Binding Target is always a Dependency Property of an object that will serve to communicate with the external world, as opposed to the internal world that is the data. Typically, the Binding Target will be the Dependency Property of a UI element (e.g., TextBox, ListBox, etc.), but can also be, for instance, a logging component, a communication channel, etc.

Edit

Related Links

DependencyProperty vs. CLR property

All content is Copyright ©2007 Xceed Software Inc. unless otherwise indicated. See the Terms of Service. Contributors must read and agree to the Contribution Policy. WPFwiki is brought to you by Xceed, makers of the powerful yet free Xceed DataGrid for WPF.