Gets or sets the data context for an element when it participates in data binding.
Assembly: PresentationFramework (in PresentationFramework.dll)
Data context is a concept that allows elements to inherit information from their parent elements about the data source that is used for binding, as well as other characteristics of the binding, such as the path.
Data context can be set directly to a common language runtime (CLR) object, with the bindings evaluating to properties of that object. Alternatively, you can set the data context to a DataSourceProvider object.
This dependency property inherits property values. If there are child elements without other values forestablished through local values or styles, then the property system will set the value to be the value of the nearest parent element with this value assigned.
Alternatively, you can use one of the following properties of the Binding class to specify the binding source explicitly: ElementName, Source, or RelativeSource. For more information, see How to: Specify the Binding Source.
In XAML, Binding declaration. You can use either property element syntax or attribute syntax. Attribute syntax is shown in the example on this page. You can also use code to set .is most typically set to as a
is a bindable property, to facilitate scenarios where one context might be bound to another. However, if you bind to , be careful to not create circular binding references (do not bind a to itself, which is possible to do because of the property value inheritance nature of the property).
A directly embedded object that serves as data context for any bindings within the parent element. Typically, this object is a Binding or another BindingBase derived class. Alternatively, raw data of any CLR object type intended for binding may be placed here, with the actual bindings defined later.
A binding usage that evaluates to an appropriate data context. For details, see Binding Markup Extension.
One of the following: or . This usage is used when referring to raw data defined as an object in resources. See XAML Resources.
The key identifier for the object being requested from within a ResourceDictionary.
The following example illustrates how a data context acts on a binding and provides the information that defines the specific values of bound properties.
Available since 3.0
Available since 2.0
Windows Phone Silverlight
Available since 7.0